Commit b2f9d5bd authored by stambaughw's avatar stambaughw

Comment translations and other minor updates.

* Complete comment translation for all EESchema source files.
* Complete comment translation for all 3D viewer source files.
* Rename class class_hierarchical_PIN_sheet to SCH_SHEET_PIN.
* Rename class DrawSheetStruct to SCH_SHEET.
* Tool tip capitalization fixes.
* Uncrustify and spell check comments and strings in all modified source
  files.
parent a3f48bf2
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_aux.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -23,9 +22,8 @@
#include "3d_viewer.h"
#include "trackball.h"
/**************************************************************************/
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/**************************************************************************/
{
int ii;
......@@ -39,13 +37,13 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/* adjust rotation */
if( m_MatRotation.x )
RotatePoint( &coord[ii].y, &coord[ii].z,
(int) (m_MatRotation.x * 10) );
(int) (m_MatRotation.x * 10) );
if( m_MatRotation.y )
RotatePoint( &coord[ii].z, &coord[ii].x,
(int) (m_MatRotation.y * 10) );
(int) (m_MatRotation.y * 10) );
if( m_MatRotation.z )
RotatePoint( &coord[ii].x, &coord[ii].y,
(int) (m_MatRotation.z * 10) );
(int) (m_MatRotation.z * 10) );
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
......@@ -55,9 +53,7 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
}
/************************************************************/
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
/************************************************************/
{
int ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
......@@ -106,17 +102,15 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
for( ii = 0; ii < nbcoord; ii++ )
{
glVertex3f( coord[ii].x * DataScale3D,
coord[ii].y * DataScale3D,
coord[ii].z * DataScale3D );
coord[ii].y * DataScale3D,
coord[ii].z * DataScale3D );
}
glEnd();
}
/**********************************************/
GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/**********************************************/
{
GLuint gllist = glGenLists( 1 );
......@@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/* class Info_3D_Visu */
/**********************/
/* Constructor */
Info_3D_Visu::Info_3D_Visu()
{
int ii;
......@@ -176,8 +169,8 @@ Info_3D_Visu::Info_3D_Visu()
m_Draw3DZone = TRUE;
m_Draw3DComments = TRUE;
m_Draw3DDrawings = TRUE;
m_Draw3DEco1 = TRUE;
m_Draw3DEco2 = TRUE;
m_Draw3DEco1 = TRUE;
m_Draw3DEco2 = TRUE;
}
......@@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu()
}
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer,
int units, int internal_unit )
......@@ -207,73 +197,63 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
text = title;
text += ReturnUnitSymbol( units );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize(
-1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition,
wxSize( -1, -1 ), 0 );
BoxSizer->Add( msgtitle, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM | wxADJUST_MINSIZE );
BoxSizer->Add(
msgtitle,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_XValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_XValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Y:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_YValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( m_YValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Z:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_ZValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( m_ZValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_YValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_ZValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
}
......@@ -282,12 +262,8 @@ WinEDA_VertexCtrl::~WinEDA_VertexCtrl()
}
/*******************************************/
/* Returns (in internal units) to coordinate between (in user units) */
S3D_Vertex WinEDA_VertexCtrl::GetValue()
/*******************************************/
/* Retourne (en unites internes) les coordonnes entrees (en unites utilisateur)
*/
{
S3D_Vertex value;
double dtmp;
......@@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue()
}
/**************************************************/
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
/**************************************************/
{
wxString text;
......@@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
}
/*****************************************/
void WinEDA_VertexCtrl::Enable( bool onoff )
/*****************************************/
{
m_XValueCtrl->Enable( onoff );
m_YValueCtrl->Enable( onoff );
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_canvas.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -35,39 +34,38 @@
*/
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
Pcb3D_GLCanvas::OnPopUpMenu )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
Pcb3D_GLCanvas::OnPopUpMenu )
END_EVENT_TABLE()
/*************************************************************************/
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#else
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#endif
/*************************************************************************/
{
m_init = FALSE;
m_gllist = 0;
m_Parent = parent;
#if wxCHECK_VERSION( 2, 9, 0 )
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext(this);
m_glRC = new wxGLContext( this );
#endif
DisplayStatus();
}
/*************************************/
Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
/*************************************/
{
ClearLists();
m_init = FALSE;
......@@ -77,9 +75,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
}
/*************************************/
void Pcb3D_GLCanvas::ClearLists()
/*************************************/
{
if( m_gllist > 0 )
glDeleteLists( m_gllist, 1 );
......@@ -87,18 +83,14 @@ void Pcb3D_GLCanvas::ClearLists()
}
/*********************************************/
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event )
/*********************************************/
{
SetView3D( event.GetKeyCode() );
event.Skip();
}
/*********************************************/
void Pcb3D_GLCanvas::SetView3D( int keycode )
/*********************************************/
{
int ii;
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
......@@ -214,9 +206,7 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
}
/********************************************************/
void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
/********************************************************/
{
wxSize size( GetClientSize() );
double spin_quat[4];
......@@ -286,10 +276,14 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
else if( event.MiddleIsDown() )
{
/* middle button drag -> pan */
/* Current zoom and an additional factor are taken into account for the amount of panning. */
/* Current zoom and an additional factor are taken into account
* for the amount of panning. */
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
g_Draw3d_dx -= PAN_FACTOR * ( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
g_Draw3d_dy -= PAN_FACTOR * (event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
g_Draw3d_dx -= PAN_FACTOR *
( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
g_Draw3d_dy -= PAN_FACTOR *
(event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
}
/* orientation has changed, redraw mesh */
......@@ -302,80 +296,76 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
/*******************************************************/
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
* de la souris
/* Construct and display a popup menu when the right button is clicked.
*/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu PopUpMenu;
pos.x = event.GetX(); pos.y = event.GetY();
wxMenuItem* item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
_( "Zoom +" ) );
_( "Zoom +" ) );
item->SetBitmap( zoom_in_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
_( "Zoom -" ) );
_( "Zoom -" ) );
item->SetBitmap( zoom_out_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
_( "Top View" ) );
_( "Top View" ) );
item->SetBitmap( axis3d_top_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
_( "Bottom View" ) );
_( "Bottom View" ) );
item->SetBitmap( axis3d_bottom_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
_( "Right View" ) );
_( "Right View" ) );
item->SetBitmap( axis3d_right_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
_( "Left View" ) );
_( "Left View" ) );
item->SetBitmap( axis3d_left_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
_( "Front View" ) );
_( "Front View" ) );
item->SetBitmap( axis3d_front_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
_( "Back View" ) );
_( "Back View" ) );
item->SetBitmap( axis3d_back_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
_( "Move left <-" ) );
_( "Move left <-" ) );
item->SetBitmap( left_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
_( "Move right ->" ) );
_( "Move right ->" ) );
item->SetBitmap( right_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
_( "Move Up ^" ) );
_( "Move Up ^" ) );
item->SetBitmap( up_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
_( "Move Down" ) );
_( "Move Down" ) );
item->SetBitmap( down_xpm );
PopUpMenu.Append( item );
......@@ -383,9 +373,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
/*******************************************************/
{
int key = 0;
......@@ -447,9 +435,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
}
/***************************************/
void Pcb3D_GLCanvas::DisplayStatus()
/***************************************/
{
wxString msg;
......@@ -464,30 +450,23 @@ void Pcb3D_GLCanvas::DisplayStatus()
}
/*************************************************/
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/
{
wxPaintDC dc( this );
Redraw();
event.Skip();
}
/***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
/***********************************************************/
{
// Do nothing, to avoid flashing.
}
/****************************/
/* Initialize broad parameters for OpenGL */
void Pcb3D_GLCanvas::InitGL()
/****************************/
/* Int parametres generaux pour OPENGL
*/
{
wxSize size = GetClientSize();
......@@ -517,7 +496,9 @@ void Pcb3D_GLCanvas::InitGL()
}
/* set viewing projection */
double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage
// Ratio width / height of the window display
double ratio_HV = (double) size.x / size.y;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
......@@ -541,17 +522,11 @@ void Pcb3D_GLCanvas::InitGL()
/* Setup light souces: */
SetLights();
}
/***********************************/
/* Initialize OpenGL light sources. */
void Pcb3D_GLCanvas::SetLights()
/***********************************/
/* Init sources lumineuses pour OPENGL
*/
{
double light;
GLfloat light_color[4];
......@@ -576,13 +551,10 @@ void Pcb3D_GLCanvas::SetLights()
}
/**********************************************************/
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
/**********************************************************/
/* Create a Screenshot of the current 3D view.
* Output file format is png or jpeg, or image is copied on clipboard
*/
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
{
wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
wxString FullFileName;
......@@ -599,15 +571,10 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
fn.SetExt( file_ext );
FullFileName =
EDA_FileSelector( _( "3D Image filename:" ),
wxEmptyString, /* Chemin par defaut */
fn.GetFullName(), /* nom fichier par defaut */
file_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString,
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
if( FullFileName.IsEmpty() )
return;
}
......@@ -630,8 +597,9 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
{
if( !wxTheClipboard->SetData( dobjBmp ) )
wxLogError( _T( "Failed to copy image to clipboard" ) );
wxTheClipboard->Flush(); /* the data on clipboard
* will stay available after the application exits */
wxTheClipboard->Flush(); /* the data in clipboard will stay
* available after the
* application exits */
wxTheClipboard->Close();
}
}
......@@ -640,7 +608,8 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
wxImage image = bitmap.ConvertToImage();
if( !image.SaveFile( FullFileName,
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG :
wxBITMAP_TYPE_PNG ) )
wxLogError( wxT( "Can't save file" ) );
image.Destroy();
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -14,37 +13,31 @@
#include "3d_viewer.h"
/****************************/
S3D_Vertex::S3D_Vertex()
/****************************/
{
x = y = z = 0.0;
}
/**************************************************************************/
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED )
/**************************************************************************/
{
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
m_AmbientIntensity = 1.0;
m_Transparency = 0.0;
m_Shininess = 1.0;
m_Transparency = 0.0;
m_Shininess = 1.0;
m_Name = name;
}
/***********************************/
void S3D_MATERIAL::SetMaterial()
/***********************************/
{
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency );
m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency );
#if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
......@@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial()
}
/****************************************************/
void S3D_MASTER::Copy( S3D_MASTER* pattern )
/****************************************************/
{
m_Shape3DName = pattern->m_Shape3DName;
m_MatScale = pattern->m_MatScale;
......@@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
}
/***************************************************************/
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL;
......@@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
}
/***************************************/
S3D_MASTER:: ~S3D_MASTER()
/***************************************/
{
Struct3D_Shape* next;
S3D_MATERIAL* nextmat;
......@@ -90,7 +77,7 @@ S3D_MASTER:: ~S3D_MASTER()
delete m_3D_Drawings;
}
for( ; m_Materials != NULL; m_Materials = nextmat )
for( ; m_Materials != NULL; m_Materials = nextmat )
{
nextmat = m_Materials->Next();
delete m_Materials;
......@@ -98,20 +85,16 @@ S3D_MASTER:: ~S3D_MASTER()
}
/***************************************************************/
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_3D_Coord = NULL;
m_3D_Coord = NULL;
m_3D_CoordIndex = NULL;
m_3D_Points = 0;
}
/***************************************/
Struct3D_Shape:: ~Struct3D_Shape()
/***************************************/
{
delete m_3D_Coord;
delete m_3D_CoordIndex;
......
......@@ -19,36 +19,32 @@
#endif
static void Draw3D_FilledCircle( double posx, double posy,
double rayon, double hole_rayon, double zpos );
static void Draw3D_FilledCircle( double posx, double posy, double rayon,
double hole_rayon, double zpos );
static void Draw3D_FilledSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_FilledCylinder( double posx, double posy,
double rayon, double height, double zpos );
static void Draw3D_FilledSegmentWithHole( double startx,
double starty,
double endx,
double endy,
double width,
double holex,
double holey,
double holeradius,
double endx, double endy,
double width, double zpos );
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
double height, double zpos );
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
double endx, double endy,
double width, double holex,
double holey, double holeradius,
double zpos );
static void Draw3D_ArcSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_CircleSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_ArcSegment( double startx, double starty, double endx,
double endy, double width, double zpos );
static void Draw3D_CircleSegment( double startx, double starty, double endx,
double endy, double width, double zpos );
static int Get3DLayerEnable( int act_layer );
static GLfloat Get3DLayerSide( int act_layer );
/******************************************/
void Pcb3D_GLCanvas::Redraw( bool finish )
/******************************************/
{
#if wxCHECK_VERSION( 2, 9, 0 )
SetCurrent(*m_glRC);
SetCurrent( *m_glRC );
#else
SetCurrent( );
SetCurrent();
#endif
// Set the OpenGL viewport according to the client size of this canvas.
......@@ -68,7 +64,7 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
/* transformations */
GLfloat mat[4][4];
// Translatory motion first, so rotations don't mess up the orientation...
// Translate motion first, so rotations don't mess up the orientation...
glTranslatef( g_Draw3d_dx, g_Draw3d_dy, 0.0F );
build_rotmatrix( mat, g_Parm_3D_Visu.m_Quat );
......@@ -92,20 +88,17 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
}
/**********************************************/
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
/**********************************************/
/* Create the draw list items
*/
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
{
WinEDA_BasePcbFrame* pcbframe = m_Parent->m_Parent;
BOARD* pcb = pcbframe->GetBoard();
TRACK* track;
SEGZONE* segzone;
SEGZONE* segzone;
int ii;
wxBusyCursor dummy;
wxBusyCursor dummy;
m_gllist = glGenLists( 1 );
......@@ -116,15 +109,17 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find a *really* single side board in the true life...
if ( g_Parm_3D_Visu.m_Layers < 2 )
// Ensure the board has 2 sides for 3D views, because it is hard to find
// a *really* single side board in the true life...
if( g_Parm_3D_Visu.m_Layers < 2 )
g_Parm_3D_Visu.m_Layers = 2;
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
g_Parm_3D_Visu.m_BoardSize.y );
// @TODO: epoxy_width (board thickness) must be set by user,
// because all boards thickness no not match with this setup:
//double epoxy_width = 1.6; // epoxy width in mm
// double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness
* g_Parm_3D_Visu.m_BoardScale;
......@@ -133,8 +128,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
for( ii = 0; ii < 32; ii++ )
{
if( ii < g_Parm_3D_Visu.m_Layers )
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width * ii
/ (g_Parm_3D_Visu.m_Layers - 1);
g_Parm_3D_Visu.m_LayerZcoord[ii] =
g_Parm_3D_Visu.m_Epoxy_Width
* ii / (g_Parm_3D_Visu.m_Layers - 1);
else
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
}
......@@ -160,14 +156,14 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
glEnable( GL_COLOR_MATERIAL );
SetGLColor( WHITE );
glBegin( GL_LINES );
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
glEnd();
}
......@@ -204,7 +200,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
glEnd();
#endif
/* move the board in order to draw it with its centre at 0,0 3D coordinates */
/* move the board in order to draw it with its center at 0,0 3D
* coordinates */
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale,
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
0.0F );
......@@ -239,24 +236,27 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
int imax = zone->m_FilledPolysList.size() - 1;
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
CPolyPt* begincorner = firstcorner;
SEGZONE dummysegment(pcb);
SEGZONE dummysegment( pcb );
dummysegment.SetLayer( zone->GetLayer() );
dummysegment.m_Width = zone->m_ZoneMinThickness;
dummysegment.m_Width = zone->m_ZoneMinThickness;
for( int ic = 1; ic <= imax; ic++ )
{
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments
if( begincorner->utility == 0 )
{
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = begincorner->x;
dummysegment.m_Start.y = begincorner->y;
dummysegment.m_End.x = endcorner->x;
dummysegment.m_End.y = endcorner->y;
Draw3D_Track( &dummysegment );
}
if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
if( (endcorner->end_contour) || (ic == imax) )
{
if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments
// the last corner of a filled area is found: draw it
if( endcorner->utility == 0 )
{
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = endcorner->x;
dummysegment.m_Start.y = endcorner->y;
dummysegment.m_End.x = firstcorner->x;
......@@ -266,18 +266,20 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
}
ic++;
if( ic < imax - 1 )
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
begincorner = firstcorner =
&zone->m_FilledPolysList[ic];
}
else
begincorner = endcorner;
}
}
}
/* draw graphic items */
EDA_BaseStruct* PtStruct;
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( PtStruct = pcb->m_Drawings;
PtStruct != NULL;
PtStruct = PtStruct->Next() )
{
switch( PtStruct->Type() )
{
......@@ -311,9 +313,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
}
/************************************************/
void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
/************************************************/
{
double zpos;
int layer = track->GetLayer();
......@@ -323,7 +323,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( layer == LAST_COPPER_LAYER )
layer = g_Parm_3D_Visu.m_Layers - 1;
......@@ -341,12 +341,9 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
}
/********************************************/
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
/*********************************************/
/* 3D drawing for a VIA (cylinder + filled circles)
*/
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
{
double x, y, r, hole;
int layer, top_layer, bottom_layer;
......@@ -367,13 +364,15 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
}
else
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) ==
false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
}
......@@ -394,14 +393,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
// Drawing hole:
color = g_Parm_3D_Visu.m_BoardSettings->m_ViaColor[via->m_Shape];
SetGLColor( color );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
Draw3D_FilledCylinder( x, -y, hole, height, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
Draw3D_FilledCylinder( x, -y, hole, height,
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
}
/*************************************************************/
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
/*************************************************************/
{
double x, y, xf, yf;
double zpos, w;
......@@ -411,7 +410,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
SetGLColor( color );
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
......@@ -490,9 +489,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
}
/*************************************************************/
void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
/*************************************************************/
{
int layer = text->GetLayer();
......@@ -508,7 +505,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
wxSize size = text->m_Size;
if( text->m_Mirror )
NEGATE(size.x);
NEGATE( size.x );
if( text->m_MultilineAllowed )
{
wxPoint pos = text->m_Pos;
......@@ -522,11 +519,10 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
{
wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
txt, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
txt, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true, Draw3dTextSegm );
pos += offset;
}
......@@ -534,17 +530,15 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
}
else
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
text->m_Text, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
text->m_Text, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
}
/*********************************************/
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/*********************************************/
{
D_PAD* pad = m_Pads;
......@@ -603,8 +597,9 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
glPopMatrix();
}
if( !As3dShape ) // The footprint does not have a 3D shape, draw its 2D shape instead
if( !As3dShape )
{
// The footprint does not have a 3D shape, draw its 2D shape instead
EDA_BaseStruct* Struct = m_Drawings;
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
for( ; Struct != NULL; Struct = Struct->Next() )
......@@ -626,9 +621,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
}
/***************************************************/
void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/***************************************************/
{
wxString s;
int dx, dy;
......@@ -637,7 +630,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
SetGLColor( color );
......@@ -670,18 +663,14 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default:
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
D(printf( "%s", CONV_TO_UTF8( s ) );)
D( printf( "%s", CONV_TO_UTF8( s ) ); )
break;
}
}
/***********************************************/
/* Draw 3D pads. */
void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
/***********************************************/
/* Dessin 3D des pads avec leur trou de percage
*/
{
int ii, ll, layer, nlmax;
int ux0, uy0,
......@@ -704,20 +693,20 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
holeY = (double) m_Drill.y * scale / 2;
hole = MIN( holeX, holeY );
/* calcul du centre des formes des pads : */
/* Calculate the center of the pad. */
shape_pos = ReturnShapePos();
ux0 = shape_pos.x;
uy0 = shape_pos.y;
xc = ux0;
yc = uy0;
/* le trace depend de la rotation de l'empreinte */
dx = dx0 = m_Size.x >> 1;
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
dy = dy0 = m_Size.y >> 1;
angle = m_Orient;
drillx = m_Pos.x * scale;
drilly = m_Pos.y * scale;
/* Draw the pad hole (TODO: draw OBLONG hole) */
if( holeX && holeY )
{
......@@ -746,10 +735,12 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
......@@ -765,15 +756,14 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
break;
case PAD_OVAL:
/* calcul de l'entraxe de l'ellipse */
if( dx > dy ) /* ellipse horizontale */
if( dx > dy ) /* Horizontal ellipse */
{
delta_cx = dx - dy;
delta_cy = 0;
w = m_Size.y * scale;
delta_angle = angle + 900;
}
else /* ellipse verticale */
else /* Vertical ellipse */
{
delta_cx = 0;
delta_cy = dy - dx;
......@@ -787,7 +777,9 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
oy = (double) ( uy0 + delta_cy ) * scale;
fx = (double) ( ux0 - delta_cx ) * scale;
fy = (double) ( uy0 - delta_cy ) * scale;
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( layer = FIRST_COPPER_LAYER;
layer <= LAST_COPPER_LAYER;
layer++ )
{
if( layer && (layer == nlmax) )
layer = CMP_N;
......@@ -795,11 +787,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER)
&& (layer < LAST_COPPER_LAYER) && !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
......@@ -808,7 +802,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
else
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos );
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx,
-drilly, hole, zpos );
}
}
break;
......@@ -819,7 +814,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
{
int ddx, ddy;
ddx = m_DeltaSize.x >> 1;
ddy = m_DeltaSize.y >> 1; /* demi dim dx et dy */
ddy = m_DeltaSize.y >> 1;
coord[0][0] = -dx - ddy;
coord[0][1] = +dy + ddx;
......@@ -839,8 +834,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
coord[ii][0] += ux0;
coord[ii][1] += uy0;
ll = ii * 2;
fcoord[ll][0] = coord[ii][0] *scale;
fcoord[ll][1] = coord[ii][1] *scale;
fcoord[ll][0] = coord[ii][0] * scale;
fcoord[ll][1] = coord[ii][1] * scale;
}
for( ii = 0; ii < 7; ii += 2 )
......@@ -870,11 +865,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
......@@ -903,9 +900,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
}
/*************************/
void SetGLColor( int color )
/*************************/
{
double red, green, blue;
StructColors colordata = ColorRefs[color & MASKCOLOR];
......@@ -917,10 +912,8 @@ void SetGLColor( int color )
}
/********************************************************/
static void Draw3D_FilledCircle( double posx, double posy,
double rayon, double hole, double zpos )
/********************************************************/
{
int ii, slice = 16;
double x, y;
......@@ -942,10 +935,8 @@ static void Draw3D_FilledCircle( double posx, double posy,
}
/*********************************************************/
static void Draw3D_FilledCylinder( double posx, double posy,
double rayon, double height, double zpos )
/*********************************************************/
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
double height, double zpos )
{
int ii;
double x, y;
......@@ -954,7 +945,7 @@ static void Draw3D_FilledCylinder( double posx, double posy,
S3D_Vertex coords[4];
double tmp = DataScale3D;
DataScale3D = 1.0; // les coord sont deja a l'echelle pour Set_Object_Data();
DataScale3D = 1.0; // Coordinate is already in range for Set_Object_Data();
coords[0].x = coords[1].x = posx + rayon;
coords[0].y = coords[1].y = posy;
coords[0].z = coords[3].z = zpos;
......@@ -979,31 +970,25 @@ static void Draw3D_FilledCylinder( double posx, double posy,
}
/*****************************************************************/
static void Draw3D_FilledSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds
*/
/* Draw a polygon similar to a segment has rounded tips */
static void Draw3D_FilledSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
double dx, dy, x, y, firstx = 0, firsty = 0;
int ii, angle;
// on va calculer les coordonnes du segment suppos horizontal,
// puis tourner les cordonnes de l'angle voulu
// Calculate the coordinates of the segment assumed horizontal.
// Then turn the strips of the desired angle.
dx = endx - startx;
dy = endy - starty;
angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 );
RotatePoint( &dx, &dy, angle ); // apres rotation: dx = longueur du segment
// dy = 0;
RotatePoint( &dx, &dy, angle );
width /= 2;
glBegin( GL_POLYGON );
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
// Trace the flare to right (1st half polygon at the end of the segment)
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0;
......@@ -1019,7 +1004,7 @@ static void Draw3D_FilledSegment( double startx, double starty,
}
}
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// Rounding the left (2nd half polygon is the origin of the segment)
for( ii = 0; ii <= 8; ii++ )
{
int jj = ii * 225;
......@@ -1034,44 +1019,35 @@ static void Draw3D_FilledSegment( double startx, double starty,
}
/*****************************************************************/
static void Draw3D_FilledSegmentWithHole( double startx,
double starty,
double endx,
double endy,
double width,
double holex,
double holey,
double holeradius,
double zpos )
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds avec trou
/* Draw a polygon similar to a segment ends with round hole
*/
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
double endx, double endy,
double width, double holex,
double holey, double holeradius,
double zpos )
{
double x, y, xin, yin;
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
int ii, angle, theta;
// on va calculer les coordonnes du segment suppos horizontal,
// puis tourner les cordonnes de l'angle voulu
// Tous des calculs se font avec startx, starty comme origine du trac
// Calculate the coordinates of the segment assumed horizontal
// Then turn the strips of the desired angle
// All calculations are done with startx, starty as the origin of the route
endx -= startx;
endy -= starty;
holex -= startx;
holey -= starty;
angle = (int) ( ( atan2( endy, endx ) * 1800 / M_PI ) + 0.5 );
RotatePoint( &endx, &endy, angle ); // apres rotation: endx = longueur du segment
// endy = 0;
RotatePoint( &endx, &endy, angle );
RotatePoint( &holex, &holey, angle );
width /= 2;
glBegin( GL_QUAD_STRIP );
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
// autour du demi-trou de percage
// Path of the flare to right (1st half polygon at the end of the segment)
// around the half-hole drilling
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0;
......@@ -1087,7 +1063,7 @@ static void Draw3D_FilledSegmentWithHole( double startx,
RotatePoint( &xin, &yin, -angle );
glVertex3f( startx + xin, starty + yin, zpos );
glVertex3f( startx + x, starty + y, zpos );
if( ii == 0 ) // Memorisation du point de dpart du trac
if( ii == 0 )
{
firstx = startx + x;
firsty = starty + y;
......@@ -1096,7 +1072,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
}
}
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// Layout of the rounded left (2nd half polygon is the origin of the
// segment)
for( ii = 0; ii <= 8; ii++ )
{
theta = -ii * 225;
......@@ -1118,15 +1095,15 @@ static void Draw3D_FilledSegmentWithHole( double startx,
}
/********************************************************/
static void Draw3D_ArcSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
static void Draw3D_ArcSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
int ii, slice = 36;
double x, y, hole, rayon;
int angle;
angle = static_cast<int>(atan2( startx - endx, starty - endy ) * 1800 / M_PI) + 900;
angle = static_cast<int>( atan2( startx - endx, starty - endy ) *
1800 / M_PI ) + 900;
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
hole = rayon - width;
......@@ -1134,10 +1111,10 @@ static void Draw3D_ArcSegment( double startx, double starty,
for( ii = 0; ii <= slice / 4; ii++ )
{
x = hole; y = 0.0;
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
glVertex3f( x + startx, y + starty, zpos );
x = rayon; y = 0.0;
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
glVertex3f( x + startx, y + starty, zpos );
}
......@@ -1145,10 +1122,8 @@ static void Draw3D_ArcSegment( double startx, double starty,
}
/*******************************************************************/
static void Draw3D_CircleSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
/*******************************************************************/
static void Draw3D_CircleSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
int ii, slice = 36;
double x, y, hole, rayon;
......@@ -1171,9 +1146,7 @@ static void Draw3D_CircleSegment( double startx, double starty,
}
/******************************************/
static int Get3DLayerEnable( int act_layer )
/******************************************/
{
bool enablelayer;
......@@ -1191,20 +1164,16 @@ static int Get3DLayerEnable( int act_layer )
}
/******************************************/
static GLfloat Get3DLayerSide( int act_layer )
/******************************************/
{
GLfloat nZ;
nZ = 1.0;
if(
(act_layer <= LAST_COPPER_LAYER - 1)
|| (act_layer == ADHESIVE_N_CU)
|| (act_layer == SOLDERPASTE_N_CU)
|| (act_layer == SILKSCREEN_N_CU)
|| (act_layer == SOLDERMASK_N_CU)
)
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|| ( act_layer == ADHESIVE_N_CU )
|| ( act_layer == SOLDERPASTE_N_CU )
|| ( act_layer == SILKSCREEN_N_CU )
|| ( act_layer == SOLDERMASK_N_CU ) )
nZ = -1.0;
return nZ;
}
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_frame.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -26,11 +25,11 @@
#include <wxstruct.h>
Info_3D_Visu g_Parm_3D_Visu;
double g_Draw3d_dx;
double g_Draw3d_dy;
double ZBottom;
double ZTop;
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
double g_Draw3d_dx;
double g_Draw3d_dy;
double ZBottom;
double ZTop;
double DataScale3D; // 3D conversion units.
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
......@@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title,
wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
/*******************************************************************/
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ),
wxSize( -1, -1 ), style )
{
m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL;
m_Parent = parent;
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
m_InternalUnits = 10000; // Internal units = 1/10000 inch
// Give it an icon
SetIcon( wxICON( icon_w3d ) );
......@@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
// Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas( this );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
wxAuiPaneInfo vert(horiz);
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top());
m_auimgr.AddPane(m_Canvas,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane( m_Canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.Update();
#endif
}
/***********************************************************/
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
/***********************************************************/
{
Close( TRUE );
}
/***********************************************************/
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/
{
SaveSettings();
if( m_Parent )
......@@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
}
/******************************************/
void WinEDA3D_DrawFrame::GetSettings()
/******************************************/
{
wxString text;
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by
// application
if( config )
{
......@@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings()
}
/*******************************************/
void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/
{
wxString text;
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by
// application
if( !Config )
return;
......@@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
}
/***********************************************************/
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
/***********************************************************/
{
int ii;
......@@ -231,40 +221,29 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
}
/************************************************************************/
void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/
{
}
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
}
/************************************/
int WinEDA3D_DrawFrame::BestZoom()
/************************************/
// Retourne le meilleur zoom
{
return 1;
}
/*******************************************************************/
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
{
}
/************************************************************************/
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
/************************************************************************/
{
#define ROT_ANGLE 10.0
......@@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
return;
default:
wxMessageBox(
wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) );
wxMessageBox( wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() \
error: unknown command" ) );
return;
}
......@@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
}
/*****************************************/
void WinEDA3D_DrawFrame::NewDisplay()
/*****************************************/
{
m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List();
// m_Canvas->InitGL();
m_Canvas->Refresh( true );
m_Canvas->DisplayStatus();
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DBgColor()
/******************************************/
/* called to set the background color of the 3D scene
*/
void WinEDA3D_DrawFrame::Set3DBgColor()
{
S3D_Color color;
wxColour newcolor, oldcolor;
......@@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DAxisOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DAxis )
g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
......@@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DModuleOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DModule )
g_Parm_3D_Visu.m_Draw3DModule = FALSE;
......@@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DZoneOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DZone )
g_Parm_3D_Visu.m_Draw3DZone = FALSE;
......@@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DComments )
g_Parm_3D_Visu.m_Draw3DComments = FALSE;
......@@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DDrawings )
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
......@@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco1OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco1 )
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
......@@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco2OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco2 )
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_read_mesh.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -18,9 +17,7 @@
#include "3d_viewer.h"
/***********************************/
int S3D_MASTER:: ReadData()
/************************************/
int S3D_MASTER::ReadData()
{
char line[1024], * text;
wxFileName fn;
......@@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData()
}
if( wxFileName::FileExists(m_Shape3DName) )
if( wxFileName::FileExists( m_Shape3DName ) )
FullFilename = m_Shape3DName;
else
{
......@@ -44,7 +41,7 @@ int S3D_MASTER:: ReadData()
if( FullFilename.IsEmpty() )
{
wxLogDebug( _( "3D part library <%s> could not be found." ),
GetChars( fn.GetFullPath() ) );
GetChars( fn.GetFullPath() ) );
return -1;
}
}
......@@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData()
return -1;
}
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard( );
// Switch the locale to standard C (needed to print floating point
// numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
......@@ -79,40 +77,36 @@ int S3D_MASTER:: ReadData()
}
fclose( file );
SetLocaleTo_Default( ); // revert to the current locale
SetLocaleTo_Default(); // revert to the current locale
return 0;
}
/*********************************************************/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
/*********************************************************/
/*
* analyse la description du type:
* material DEF yellow Material {
* diffuseColor 1.00000 1.00000 0.00000e+0
* emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0
* specularColor 1.00000 1.00000 1.00000
* ambientIntensity 1.00000
* transparency 0.00000e+0
* shininess 1.00000
* }
* ou du type:
* material USE yellow
* Analyzes the description of the type:
* DEF yellow material Material (
* DiffuseColor 1.00000 1.00000 0.00000e 0
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* SpecularColor 1.00000 1.00000 1.00000
* AmbientIntensity 1.00000
* Transparency 0.00000e 0
* Shininess 1.00000
*)
* Or type:
* USE yellow material
*/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
{
char line[512], * text, * command;
wxString mat_name;
S3D_MATERIAL* material = NULL;
// Lecture de la commande:
command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" );
mat_name = CONV_FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 )
{
for( material = m_Materials; material; material = material->Next() )
for( material = m_Materials; material; material = material->Next() )
{
if( material->m_Name == mat_name )
{
......@@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
}
/**********************************************************/
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
/***********************************************************/
{
char line[1024], * text;
......@@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
}
/********************************************************/
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
/********************************************************/
{
char line[1024], * text;
int err = 1;
......@@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
}
/*************************************************************/
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
/*************************************************************/
{
char line[1024], * text;
int err = 1;
......@@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
#define BUFSIZE 2000
/************************************************************************************/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
/************************************************************************************/
/* Read a coordinate liste like:
/* Read a coordinate list like:
* coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2,
* -5.11821 6.57421e-3 0.542654,
......@@ -305,6 +289,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
* text_buffer contains the first line of this node :
* "coord Coordinate { point ["
*/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
int* LineNum )
{
double* data_list = NULL;
unsigned int ii = 0, jj = 0, nn = BUFSIZE;
......@@ -351,7 +337,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
if( ii >= nn )
{
nn *= 2;
data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) );
data_list =
(double*) realloc( data_list, ( nn * sizeof(double) ) );
}
HasData = FALSE;
if( *text == ']' )
......@@ -384,9 +371,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
}
/***********************************************************/
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
/***********************************************************/
{
char line[1024], buffer[1024], * text;
int err = 1;
......@@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normal" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
......@@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "color" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
......@@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
/*********************************************************/
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
/*********************************************************/
{
char line[512];
......
/********************************************************/
/* 3d_struct.h : definition des structures de donnees */
/* pour la representation 3D des modules */
/********************************************************/
/*****************/
/* 3d_struct.h */
/*****************/
#ifndef STRUCT_3D_H
#define STRUCT_3D_H
#include "base_struct.h"
/* 3D modeler units -> PCB units conversion scale:
* 1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */
/* 3D modeling units -> PCB units conversion scale:
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch
*/
#define UNITS3D_TO_UNITSPCB 1000
class S3D_MASTER;
class Struct3D_Shape;
class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/
class S3D_Color /* 3D color (R, G, G) 3 floats range 0 to 1.0*/
{
public:
double m_Red, m_Green, m_Blue;
public:
S3D_Color() {
public: S3D_Color()
{
m_Red = m_Green = m_Blue = 0;
}
};
class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/
class S3D_Vertex /* 3D coordinate (3 float numbers: x,y,z coordinates)*/
{
public:
double x, y, z;
public:
S3D_Vertex();
public: S3D_Vertex();
};
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
......@@ -45,8 +45,7 @@ public:
float m_Transparency;
float m_Shininess;
public:
S3D_MATERIAL( S3D_MASTER * father, const wxString &name );
public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
......@@ -55,10 +54,8 @@ public:
};
/*******************************************/
class S3D_MASTER : public EDA_BaseStruct
/*******************************************/
/* Master structure for a 3D item description */
class S3D_MASTER : public EDA_BaseStruct
{
public:
wxString m_Shape3DName; /* 3D shape name in 3D library */
......@@ -68,9 +65,7 @@ public:
Struct3D_Shape* m_3D_Drawings;
S3D_MATERIAL* m_Materials;
public:
S3D_MASTER( EDA_BaseStruct * aParent );
public: S3D_MASTER( EDA_BaseStruct* aParent );
~S3D_MASTER();
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
......@@ -82,30 +77,27 @@ public:
m_Materials = aMaterial;
}
void Copy( S3D_MASTER* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
void Copy( S3D_MASTER* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
};
/*********************************************/
/* Describes a complex 3D */
class Struct3D_Shape : public EDA_BaseStruct
/*********************************************/
/* decrit une forme complexe 3D */
{
public:
S3D_Vertex* m_3D_Coord;
int* m_3D_CoordIndex;
int m_3D_Points;
public:
Struct3D_Shape( EDA_BaseStruct * aParent );
public: Struct3D_Shape( EDA_BaseStruct* aParent );
~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
......@@ -115,14 +107,11 @@ public:
};
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units.
* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
*/
class WinEDA_VertexCtrl
{
......@@ -133,18 +122,15 @@ private:
wxStaticText* m_Text;
public:
// Constructor and destructor
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
wxBoxSizer * BoxSizer,
int units, int internal_unit );
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, int units, int internal_unit );
~WinEDA_VertexCtrl();
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
};
......
/*******************************************************************/
/* 3d_toolbar.cpp: construction des tool bars de la frame visu 3d */
/*******************************************************************/
/********************/
/* 3d_toolbar.cpp */
/********************/
#include "fctsys.h"
#include "macros.h"
......@@ -9,31 +9,34 @@
#include "3d_viewer.h"
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateHToolbar()
/*********************************************/
{
if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens
{
// Simple update to the list of old files.
SetToolbars();
return;
}
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !KICAD_AUIMANAGER
SetToolBar( (wxToolBar*)m_HToolBar );
SetToolBar( (wxToolBar*) m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
wxBitmap( import3d_xpm ),
_( "Reload board" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__)) // do not work properly under linux
m_HToolBar-> AddSeparator();
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
wxBitmap( copy_button ),
_( "Copy 3D Image to Clipboard" ) );
_( "Copy 3D Image to Clipboard" ) );
#endif
m_HToolBar->AddSeparator();
......@@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
_( "Move right ->" ) );
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
_( "Move Up ^" ) );
_( "Move up ^" ) );
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
_( "Move Down" ) );
_( "Move down" ) );
m_HToolBar->Realize();
// SetToolbars();
}
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateVToolbar()
/*********************************************/
{
}
/**********************************************/
void WinEDA3D_DrawFrame::ReCreateMenuBar()
/**********************************************/
{
bool full_options = true;
bool full_options = true;
// If called from the display frame of cvpcb, only some options are relevant
if ( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all options
// If called from the display frame of cvpcb, only some options are
// relevant
if( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all
// options
wxMenuBar* menuBar = new wxMenuBar;
......@@ -119,8 +118,10 @@ bool full_options = true;
menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG,
_( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ) );
fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
......@@ -133,33 +134,31 @@ bool full_options = true;
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), axis3d_front_xpm );
if ( full_options )
if( full_options )
{
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), add_zone_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), add_zone_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), edit_sheet_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), edit_sheet_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), add_polygon_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), add_polygon_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), tools_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), tools_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), tools_xpm );
}
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), tools_xpm );
}
SetMenuBar( menuBar );
}
/*****************************************/
void WinEDA3D_DrawFrame::SetToolbars()
/*****************************************/
{
}
......@@ -26,10 +26,10 @@
#include "id.h"
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
#define LIB3D_PATH wxT("packages3d")
#define LIB3D_PATH wxT( "packages3d" )
/**
* Command IDs for the 3D viewer.
......@@ -100,104 +100,106 @@ class SEGVIA;
class Info_3D_Visu
{
public:
double m_Beginx, m_Beginy; /* position of mouse */
double m_Quat[4]; /* orientation of object */
double m_Rot[4]; /* man rotation of object */
double m_Zoom; /* field of view in degrees */
double m_Beginx, m_Beginy; /* position of mouse */
double m_Quat[4]; /* orientation of object */
double m_Rot[4]; /* man rotation of object */
double m_Zoom; /* field of view in degrees */
S3D_Color m_BgColor;
bool m_Draw3DAxis;
bool m_Draw3DModule;
bool m_Draw3DZone;
bool m_Draw3DComments;
bool m_Draw3DDrawings;
bool m_Draw3DEco1;
bool m_Draw3DEco2;
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_Layers;
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
double m_BoardScale; /* Normalisation scale for coordinates:
when scaled tey are between -1.0 and +1.0 */
double m_LayerZcoord[32];
public:
Info_3D_Visu();
bool m_Draw3DAxis;
bool m_Draw3DModule;
bool m_Draw3DZone;
bool m_Draw3DComments;
bool m_Draw3DDrawings;
bool m_Draw3DEco1;
bool m_Draw3DEco2;
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_Layers;
EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design
// settings
double m_Epoxy_Width; /* Epoxy thickness (normalized)
**/
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[32];
public: Info_3D_Visu();
~Info_3D_Visu();
};
class Pcb3D_GLCanvas: public wxGLCanvas
class Pcb3D_GLCanvas : public wxGLCanvas
{
public:
WinEDA3D_DrawFrame * m_Parent;
WinEDA3D_DrawFrame* m_Parent;
private:
bool m_init;
GLuint m_gllist;
bool m_init;
GLuint m_gllist;
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLContext* m_glRC;
#endif
public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );
Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
~Pcb3D_GLCanvas();
void ClearLists();
void OnPaint(wxPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnRightClick(wxMouseEvent& event);
void OnPopUpMenu(wxCommandEvent & event);
void TakeScreenshot(wxCommandEvent & event);
void SetView3D(int keycode);
void DisplayStatus();
void Redraw(bool finish = false);
void ClearLists();
void OnPaint( wxPaintEvent& event );
void OnEraseBackground( wxEraseEvent& event );
void OnChar( wxKeyEvent& event );
void OnMouseEvent( wxMouseEvent& event );
void OnRightClick( wxMouseEvent& event );
void OnPopUpMenu( wxCommandEvent& event );
void TakeScreenshot( wxCommandEvent& event );
void SetView3D( int keycode );
void DisplayStatus();
void Redraw( bool finish = false );
GLuint DisplayCubeforTest();
void OnEnterWindow( wxMouseEvent& event );
void OnEnterWindow( wxMouseEvent& event );
void Render();
void Render();
GLuint CreateDrawGL_List();
void InitGL();
void SetLights();
void Draw3D_Track(TRACK * track);
void Draw3D_Via(SEGVIA * via);
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
void Draw3D_DrawText(TEXTE_PCB * text);
void InitGL();
void SetLights();
void Draw3D_Track( TRACK* track );
void Draw3D_Via( SEGVIA* via );
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
void Draw3D_DrawText( TEXTE_PCB* text );
//int Get3DLayerEnable(int act_layer);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class WinEDA3D_DrawFrame: public wxFrame
class WinEDA3D_DrawFrame : public wxFrame
{
public:
WinEDA_BasePcbFrame * m_Parent;
Pcb3D_GLCanvas * m_Canvas;
WinEDA_Toolbar * m_HToolBar;
WinEDA_Toolbar * m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
WinEDA_BasePcbFrame* m_Parent;
Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
#if KICAD_AUIMANAGER
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
private:
wxString m_FrameName; // name used for writting and reading setup
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent,
const wxString& title,
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent & Event);
void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateMenuBar();
void ReCreateHToolbar();
void ReCreateVToolbar();
......@@ -205,13 +207,13 @@ public:
void GetSettings();
void SaveSettings();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
void OnKeyEvent(wxKeyEvent& event);
int BestZoom(); // Retourne le meilleur zoom
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
void Process_Special_Functions(wxCommandEvent& event);
void Process_Zoom(wxCommandEvent& event);
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnKeyEvent( wxKeyEvent& event );
int BestZoom();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom( wxCommandEvent& event );
void NewDisplay();
void Set3DBgColor();
......@@ -227,13 +229,13 @@ public:
DECLARE_EVENT_TABLE()
};
void SetGLColor(int color);
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
void SetGLColor( int color );
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord );
extern Info_3D_Visu g_Parm_3D_Visu;
extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop;
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
extern int gl_attrib[];
extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop;
extern double DataScale3D; // 3D scale units.
extern int gl_attrib[];
#endif /* __3D_VIEWER_H__ */
......@@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
// Add all pins sheets of a selected hierarchical sheet to the list
Hierarchical_PIN_Sheet_Struct* SLabel =
( (DrawSheetStruct*) Struct )->m_Label;
SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
while( SLabel )
{
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
AddPickedItem( screen, SLabel->m_Pos );
SLabel = (Hierarchical_PIN_Sheet_Struct*) SLabel->Next();
SLabel = (SCH_SHEET_PIN*) SLabel->Next();
}
}
......
......@@ -300,7 +300,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
/* Fill aList with Glabel info
*/
SCH_ITEM* DrawList;
Hierarchical_PIN_Sheet_Struct* PinLabel;
SCH_SHEET_PIN* PinLabel;
DrawSheetPath* sheet;
/* Build the sheet list */
......@@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
case DRAW_SHEET_STRUCT_TYPE:
{
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
while( PinLabel != NULL )
{
labet_object.m_LabelType =
......@@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
wxString* Text1, * Text2;
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) (obj1.m_Label) )->m_Text;
Text1 = &( (SCH_SHEET_PIN*) (obj1.m_Label) )->m_Text;
else
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) (obj2.m_Label) )->m_Text;
Text2 = &( (SCH_SHEET_PIN*) (obj2.m_Label) )->m_Text;
else
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
......@@ -464,12 +464,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
if( ii == 0 )
{
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text1 = ( (Hierarchical_PIN_Sheet_Struct*) obj1.m_Label )->m_Text;
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
else
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text2 = ( (Hierarchical_PIN_Sheet_Struct*) obj2.m_Label )->m_Text;
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
else
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
......@@ -804,7 +804,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
{
/************************************************************************/
SCH_LABEL* DrawTextItem;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
SCH_SHEET_PIN* DrawSheetLabel;
wxString msg, sheetpath;
wxString labeltype;
......@@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
{
DrawSheetLabel =
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
int jj = DrawSheetLabel->m_Shape;
if( jj < 0 )
jj = NET_TMAX;
......
......@@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
EDA_BaseStruct* item;
LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet;
SCH_SHEET_PIN* pinsheet;
wxPoint itempos;
switch( layer )
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
......@@ -24,7 +24,7 @@
/***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
{
/***********************************************************/
......@@ -41,10 +41,10 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
/**************************************/
DrawSheetStruct::~DrawSheetStruct()
SCH_SHEET::~SCH_SHEET()
{
/**************************************/
Hierarchical_PIN_Sheet_Struct* label = m_Label, * next_label;
SCH_SHEET_PIN* label = m_Label, * next_label;
while( label )
{
......@@ -65,7 +65,7 @@ DrawSheetStruct::~DrawSheetStruct()
/**********************************************/
bool DrawSheetStruct::Save( FILE* aFile ) const
bool SCH_SHEET::Save( FILE* aFile ) const
/***********************************************/
/** Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
......@@ -74,7 +74,7 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
*/
{
bool Success = true;
Hierarchical_PIN_Sheet_Struct* SheetLabel;
SCH_SHEET_PIN* SheetLabel;
fprintf( aFile, "$Sheet\n" );
......@@ -128,13 +128,13 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
/***********************************************/
DrawSheetStruct* DrawSheetStruct::GenCopy()
SCH_SHEET* SCH_SHEET::GenCopy()
{
/***********************************************/
/* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated
*/
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
newitem->m_Size = m_Size;
......@@ -153,7 +153,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
newitem->m_Label = NULL;
Hierarchical_PIN_Sheet_Struct* Slabel = NULL, * label = m_Label;
SCH_SHEET_PIN* Slabel = NULL, * label = m_Label;
if( label )
{
......@@ -180,7 +180,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
/**********************************************************/
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
{
/**********************************************************/
/* Used if undo / redo command:
......@@ -196,7 +196,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
// Ensure sheet labels have their .m_Parent member poiuntin really on their
// parent, after swapping.
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label )
{
label->SetParent( this );
......@@ -213,7 +213,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/********************************************************************/
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{
/********************************************************************/
/* Place list structures for new sheet. */
......@@ -241,7 +241,7 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/********************************************************************/
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
bool aRedraw )
{
/********************************************************************/
......@@ -250,7 +250,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
* @param aRedraw = true to redraw Sheet
* @param aFrame = the schematic frame
*/
Hierarchical_PIN_Sheet_Struct* Pinsheet, * NextPinsheet;
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
return;
......@@ -291,16 +291,15 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int DrawSheetStruct::GetPenSize()
int SCH_SHEET::GetPenSize()
{
return g_DrawDefaultLineThickness;
}
/*****************************************************************************/
void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode, int aColor )
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDrawMode, int aColor )
{
/*****************************************************************************/
/** Function Draw
......@@ -312,7 +311,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items
*/
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
SCH_SHEET_PIN* SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
......@@ -366,7 +365,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/*****************************************/
EDA_Rect DrawSheetStruct::GetBoundingBox()
EDA_Rect SCH_SHEET::GetBoundingBox()
{
/*****************************************/
/** Function GetBoundingBox
......@@ -391,7 +390,7 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
/************************************************/
bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
{
/************************************************/
/** Function HitTest
......@@ -405,7 +404,7 @@ bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
/************************************/
int DrawSheetStruct::ComponentCount()
int SCH_SHEET::ComponentCount()
{
/************************************/
/** Function ComponentCount
......@@ -427,7 +426,7 @@ int DrawSheetStruct::ComponentCount()
}
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) bs;
SCH_SHEET* sheet = (SCH_SHEET*) bs;
n += sheet->ComponentCount();
}
}
......@@ -437,8 +436,7 @@ int DrawSheetStruct::ComponentCount()
/*****************************************************************************/
bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
SCH_SCREEN** aScreen )
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
{
/*****************************************************************************/
/** Function SearchHierarchy
......@@ -454,7 +452,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->m_AssociatedScreen
&& ss->m_AssociatedScreen->m_FileName.CmpNoCase( aFilename ) == 0 )
{
......@@ -472,8 +470,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
/*******************************************************************************/
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
DrawSheetPath* aList )
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
{
/*******************************************************************************/
/** Function LocatePathOfScreen
......@@ -496,7 +493,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->LocatePathOfScreen( aScreen, aList ) )
return true;
}
......@@ -510,7 +507,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
/**********************************************************/
bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
{
/***********************************************************/
/** Function Load.
......@@ -546,7 +543,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
{
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheetstruct = (DrawSheetStruct*) bs;
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
if( !sheetstruct->Load( aFrame ) )
success = false;
}
......@@ -560,7 +557,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
/**********************************/
int DrawSheetStruct::CountSheets()
int SCH_SHEET::CountSheets()
{
/**********************************/
/** Function CountSheets
......@@ -577,7 +574,7 @@ int DrawSheetStruct::CountSheets()
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* subsheet = (DrawSheetStruct*) strct;
SCH_SHEET* subsheet = (SCH_SHEET*) strct;
count += subsheet->CountSheets();
}
}
......@@ -587,7 +584,7 @@ int DrawSheetStruct::CountSheets()
/******************************************/
wxString DrawSheetStruct::GetFileName( void )
wxString SCH_SHEET::GetFileName( void )
{
/******************************************/
return m_FileName;
......@@ -595,7 +592,7 @@ wxString DrawSheetStruct::GetFileName( void )
/************************************************************************/
bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName )
{
/************************************************************************/
......@@ -710,7 +707,7 @@ otherwise delete current sheet data)" );
/***********************************************************/
void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
{
frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
......@@ -722,7 +719,7 @@ void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
* mirror item relative to an Y axis
* @param aYaxis_position = the y axis position
*/
void DrawSheetStruct::Mirror_Y( int aYaxis_position )
void SCH_SHEET::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
......@@ -730,7 +727,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
m_Pos.x -= m_Size.x;
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
{
label->Mirror_Y( aYaxis_position );
......@@ -740,7 +737,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
#if defined(DEBUG)
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
{
// XML output:
wxString s = GetClass();
......@@ -750,7 +747,7 @@ void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
<< '"' << ">\n";
// show all the pins, and check the linked list integrity
Hierarchical_PIN_Sheet_Struct* label;
SCH_SHEET_PIN* label;
for( label = m_Label; label; label = label->Next() )
{
label->Show( nestLevel + 1, os );
......
......@@ -7,17 +7,19 @@
#include "base_struct.h"
extern DrawSheetStruct* g_RootSheet;
/* class Hierarchical_PIN_Sheet_Struct
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for
* a component
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire,
* bus or label
* A sheet level it corresponds to a hierarchical label.
extern SCH_SHEET* g_RootSheet;
/**
* Pin (label) used in sheets to create hierarchical schematics.
*
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* pin is used in a component. It connects the ojects in the sheet object
* to the objects in the schecmitic page to the objects in the page that is
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
* connected to a wire, bus, or label. In the schematic page represented by
* the sheet, it corresponds to a hierarchical label.
*/
class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
public EDA_TextStruct
class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
{
public:
int m_Edge, m_Shape;
......@@ -26,23 +28,23 @@ public:
// m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename
public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
public: SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { }
~SCH_SHEET_PIN() { }
virtual wxString GetClass() const
{
return wxT( "Hierarchical_PIN_Sheet_Struct" );
return wxT( "SCH_SHEET_PIN" );
}
Hierarchical_PIN_Sheet_Struct* GenCopy();
SCH_SHEET_PIN* GenCopy();
Hierarchical_PIN_Sheet_Struct* Next()
SCH_SHEET_PIN* Next()
{
return ( Hierarchical_PIN_Sheet_Struct*) Pnext;
return ( SCH_SHEET_PIN*) Pnext;
}
void Place( WinEDA_SchematicFrame* frame,
......@@ -108,12 +110,12 @@ public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
};
/* class DrawSheetStruct
/* class SCH_SHEET
* This class is the sheet symbol placed in a schematic, and is the entry point
* for a sub schematic
*/
class DrawSheetStruct : public SCH_ITEM
class SCH_SHEET : public SCH_ITEM
{
public:
wxString m_SheetName; /* this is equivalent to C101 for
......@@ -132,22 +134,23 @@ public:
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of *sheet symbol */
int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked
* list.*/
SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
* list.*/
int m_NbLabel; /* Pins sheet (corresponding to
* hierarchical labels) count */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
* handle the physical data
* In complex hierarchies we
* can have many DrawSheetStruct
* can have many SCH_SHEET
* using the same data
*/
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct();
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_SHEET();
virtual wxString GetClass() const
{
return wxT( "DrawSheetStruct" );
return wxT( "SCH_SHEET" );
}
......@@ -158,23 +161,23 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
bool Save( FILE* aFile ) const;
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function CleanupSheet
* Delete pinsheets which are not corresponding to a hierarchical label
* @param aRedraw = true to redraw Sheet
* @param aFrame = the schematic frame
*/
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize();
virtual int GetPenSize();
/** Function Draw
* Draw the hierarchical sheet shape
......@@ -185,11 +188,11 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
* @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items
*/
void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode,
int aColor = -1 );
void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode,
int aColor = -1 );
/** Function HitTest
* @return true if the point aPosRef is within item area
......@@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
*/
EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem );
void SwapData( SCH_SHEET* copyitem );
/** Function ComponentCount
* count our own components, without the power components.
......@@ -277,7 +280,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName );
//void RemoveSheet(DrawSheetStruct* sheet);
//void RemoveSheet(SCH_SHEET* sheet);
//to remove a sheet, just delete it
//-- the destructor should take care of everything else.
......@@ -290,7 +293,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
{
label->Move( aMoveVector );
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
......@@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
{
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
Push( sheet );
if( aPath == Path() )
return true;
......@@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* DrawSheetPath::Last()
SCH_SHEET* DrawSheetPath::Last()
{
if( m_numSheets )
return m_sheets[m_numSheets - 1];
......@@ -134,12 +134,12 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
/**************************************************/
void DrawSheetPath::Push( DrawSheetStruct* aSheet )
void DrawSheetPath::Push( SCH_SHEET* aSheet )
{
/**************************************************/
/** Function Push
* store (push) aSheet in list
* @param aSheet = pointer to the DrawSheetStruct to store in list
* @param aSheet = pointer to the SCH_SHEET to store in list
*/
if( m_numSheets > DSLSZ )
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
......@@ -153,11 +153,11 @@ to store sheet" ) );
}
DrawSheetStruct* DrawSheetPath::Pop()
SCH_SHEET* DrawSheetPath::Pop()
{
/** Function Pop
* retrieves (pop) the last entered sheet and remove it from list
* @return a DrawSheetStruct* pointer to the removed sheet in list
* @return a SCH_SHEET* pointer to the removed sheet in list
*/
if( m_numSheets > 0 )
{
......@@ -287,7 +287,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
/*******************************************************/
EDA_SheetList::EDA_SheetList( DrawSheetStruct* aSheet )
EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet )
{
/*******************************************************/
/* The constructor: build the list of sheets from aSheet.
......@@ -347,7 +347,7 @@ DrawSheetPath* EDA_SheetList::GetSheet( int aIndex )
/************************************************************************/
void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet )
{
/************************************************************************/
/** Function BuildSheetList
......@@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet );
}
strct = strct->Next();
......
......@@ -70,7 +70,7 @@ private:
public:
#define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct * m_sheets[DSLSZ];
SCH_SHEET * m_sheets[DSLSZ];
public: DrawSheetPath();
~DrawSheetPath() { };
......@@ -97,7 +97,7 @@ public: DrawSheetPath();
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* Last();
SCH_SHEET* Last();
/** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list
......@@ -112,19 +112,19 @@ public: DrawSheetPath();
/** Function Push
* store (push) aSheet in list
* @param aSheet = pointer to the DrawSheetStruct to store in list
* @param aSheet = pointer to the SCH_SHEET to store in list
* Push is used when entered a sheet to select or analyze it
* This is like cd <directory> in directories navigation
*/
void Push( DrawSheetStruct* aSheet );
void Push( SCH_SHEET* aSheet );
/** Function Pop
* retrieves (pop) the last entered sheet and remove it from list
* @return a DrawSheetStruct* pointer to the removed sheet in list
* @return a SCH_SHEET* pointer to the removed sheet in list
* Pop is used when leaving a sheet after a selection or analyze
* This is like cd .. in directories navigation
*/
DrawSheetStruct* Pop();
SCH_SHEET* Pop();
/** Function Path
* the path uses the time stamps which do not changes even when editing
......@@ -202,7 +202,7 @@ public:
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
* So usually call it with no param.
*/
EDA_SheetList( DrawSheetStruct* aSheet = NULL );
EDA_SheetList( SCH_SHEET* aSheet = NULL );
~EDA_SheetList()
{
......@@ -243,7 +243,7 @@ private:
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
* @param aSheet = the starting sheet from the built is made
*/
void BuildSheetList( DrawSheetStruct* sheet );
void BuildSheetList( SCH_SHEET* sheet );
};
#endif /* CLASS_DRAWSHEET_PATH_H */
/////////////////////////////////////////////////////////////////////////////
// Name: class_hierarchical_PIN_sheet.cpp
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
// Purpose: member functions SCH_SHEET_PIN
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
......@@ -23,10 +23,9 @@
/*******************************************************************/
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
DrawSheetStruct* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
EDA_TextStruct( text )
{
......@@ -43,12 +42,11 @@ Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
/***********************************************************/
Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
{
/***********************************************************/
Hierarchical_PIN_Sheet_Struct* newitem =
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos,
m_Text );
SCH_SHEET_PIN* newitem =
new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
......@@ -61,18 +59,18 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int Hierarchical_PIN_Sheet_Struct::GetPenSize()
int SCH_SHEET_PIN::GetPenSize()
{
return g_DrawDefaultLineThickness;
}
/*****************************************************************************/
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color )
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color )
{
/*****************************************************************************/
/* Routine to create hierarchical labels */
......@@ -124,9 +122,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
* @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
{
wxSize size = m_Size;
......@@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
bool SCH_SHEET_PIN::Save( FILE* aFile ) const
{
int type = 'U', side = 'L';
......@@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
#if defined(DEBUG)
void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
{
// XML output:
wxString s = GetClass();
......
......@@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT()
{
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
m_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
m_Link = NULL; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
m_Flag = 0; /* flag used in calculations */
......
......@@ -41,8 +41,8 @@ class NETLIST_OBJECT
public:
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */
EDA_BaseStruct* m_Comp; /* Pointer on the library item that created this net object (the parent)*/
SCH_ITEM* m_Link; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
int m_Flag; /* flag used in calculations */
......
......@@ -251,7 +251,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
{
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ds = (DrawSheetStruct*) s;
SCH_SHEET* ds = (SCH_SHEET*) s;
s = ds->m_AssociatedScreen;
}
if( s && s->Type() == SCREEN_STRUCT_TYPE )
......
......@@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct )
{
( (DrawSheetStruct*) DrawStruct )->DisplayInfo( this );
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
return DrawStruct;
}
......
......@@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SHEET_STRUCT_TYPE:
{
Hierarchical_PIN_Sheet_Struct* pinsheet;
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label;
SCH_SHEET_PIN* pinsheet;
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
pinsheet;
pinsheet = pinsheet->Next() )
{
......
......@@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
EDA_BaseStruct* DrawList;
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
SCH_SHEET_PIN* SheetLabel, * NextLabel;
if( DrawStruct == NULL )
return;
......@@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
continue;
/* See if our item is in this Sheet */
SheetLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
if( SheetLabel == NULL )
continue;
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
{
( (DrawSheetStruct*) DrawList )->m_Label =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
( (SCH_SHEET*) DrawList )->m_Label =
(SCH_SHEET_PIN*) SheetLabel->Next();
SAFE_DELETE( DrawStruct );
return;
......@@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
while( SheetLabel->Next() )
{
NextLabel =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
{
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
SAFE_DELETE( DrawStruct );
......
......@@ -13,7 +13,7 @@
/**************************************************************************/
void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
/**************************************************************************/
/* Free (delete) all schematic data (include the sub hierarchy sheets )
......@@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct,
confirm_deletion );
}
}
......
......@@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case DRAW_SHEET_STRUCT_TYPE:
{
DrawSheetStruct* Struct = (DrawSheetStruct*) aItem;
SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox,
aDC,
Struct->m_Pos.x + aOffset.x,
......
......@@ -49,7 +49,7 @@ int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
DrawSheetStruct* g_RootSheet = NULL;
SCH_SHEET* g_RootSheet = NULL;
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
......
......@@ -198,17 +198,17 @@ int TestDuplicateSheetNames()
continue;
// We have found a second sheet: compare names
if( ( (DrawSheetStruct*) ref_item )->m_SheetName.CmpNoCase(
( ( DrawSheetStruct* ) item_to_test )-> m_SheetName )
if( ( (SCH_SHEET*) ref_item )->m_SheetName.CmpNoCase(
( ( SCH_SHEET* ) item_to_test )-> m_SheetName )
== 0 )
{
/* Create a new marker type ERC error*/
MARKER_SCH* Marker = new MARKER_SCH();
Marker->m_TimeStamp = GetTimeStamp();
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (DrawSheetStruct*) item_to_test )->m_Pos,
( (SCH_SHEET*) item_to_test )->m_Pos,
_( "Duplicate Sheet name" ),
( (DrawSheetStruct*) item_to_test )->m_Pos );
( (SCH_SHEET*) item_to_test )->m_Pos );
Marker->SetMarkerType( MARK_ERC );
Marker->SetErrorLevel( ERR );
Marker->SetNext( Screen->EEDrawList );
......
......@@ -15,12 +15,10 @@
#include "class_library.h"
/****************************************************************/
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/
/* Commands to save project or the current page.
*/
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
{
int id = event.GetId();
......@@ -45,7 +43,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
}
/*
/**
* Load an entire project
*
* Schematic root file and its subhierarchies, the configuration and the libs
......@@ -60,7 +58,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
......@@ -68,7 +67,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
if( screen )
{
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
if( !IsOK( this, _( "Clear schematic hierarchy?" ) ) )
return FALSE;
if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
......@@ -126,7 +125,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
return 1;
}
// Rechargement de la configuration:
// Reloading configuration.
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
......@@ -145,7 +144,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
/* Loading the project library cache
* until apr 2009 the lib is named <root_name>.cache.lib
* and after (due to code change): <root_name>-cache.lib
* so if the <name>-cache.lib is not foun, the od way will be tried
* so if the <name>-cache.lib is not found, the old way will be tried
*/
bool use_oldcachename = false;
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
......@@ -208,11 +207,11 @@ Error: %s" ),
return -1;
}
//load the project.
// load the project.
SAFE_DELETE( g_RootSheet->m_AssociatedScreen );
bool diag = g_RootSheet->Load( this );
/* Reaffichage ecran de base (ROOT) si necessaire */
/* Redraw base screen (ROOT) if necessary. */
ActiveScreen = GetScreen();
ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
Zoom_Automatique( FALSE );
......@@ -222,15 +221,13 @@ Error: %s" ),
}
/**********************************************************/
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN* OldScreen, int TimeStamp )
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
* cet ecran est en chainage arriere avec OldScreen
* la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
/* Create a new screen
*
* This screen is chained with OldScreen. The timestamp value is assigned to
* the parameter NewScreen-> TimeStamp
*/
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN* OldScreen,
int TimeStamp )
{
SCH_SCREEN* NewScreen;
......@@ -247,13 +244,12 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
}
/****************************************************/
void WinEDA_SchematicFrame::SaveProject()
/****************************************************/
/* Saves the entire project and creates an archive for components
* the library archive name is <root_name>.cache.lib
/**
* Save the entire project and create an archive for components.
*
* The library archive name is <root_name>.cache.lib
*/
void WinEDA_SchematicFrame::SaveProject()
{
SCH_SCREEN* screen;
wxFileName fn;
......@@ -266,7 +262,7 @@ void WinEDA_SchematicFrame::SaveProject()
SaveEEFile( screen, FILE_SAVE_AS );
}
/* Creation du fichier d'archivage composants en repertoire courant */
/* Archive components in current directory. */
fn = g_RootSheet->GetFileName();
wxString cachename = fn.GetName() + wxT("-cache");
fn.SetName( cachename );
......@@ -275,38 +271,13 @@ void WinEDA_SchematicFrame::SaveProject()
}
/************************/
int CountCmpNumber()
/************************/
/**
* Return the number of components in the schematic.
*
* Power components are not included.
*/
/* Routine retournant le nombre de composants dans le schema,
* powers non comprises */
int CountCmpNumber()
{
return g_RootSheet->ComponentCount();
/*
* BASE_SCREEN* Window;
* EDA_BaseStruct* Phead;
* int Nb = 0;
*
*
*
* Window = ScreenSch;
* while( Window )
* {
* for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
* {
* if( Phead->Type() == TYPE_SCH_COMPONENT )
* {
* DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
* if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
* Nb++;
* }
* }
*
* Window = (BASE_SCREEN*) Window->Pnext;
* }
*
* return Nb;
*/
}
/***************************************/
/* GENERAL.H : declarations communes */
/***************************************/
/***************/
/* GENERAL.H */
/***************/
#ifndef _GENERAL_H_
#define _GENERAL_H_
/* Entete des fichiers schematique */
#define EESCHEMA_VERSION 2
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
......@@ -15,12 +14,11 @@
#define MAX_PIN_INFO 10
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places
* sur fils ( labels, num pins ) */
#define TXTMARGE 10 /* Offset in mils for placement of labels
* and pin numbers. */
#define HIGHLIGHT_COLOR WHITE
/* Used for EDA_BaseStruct, .m_Select member */
#define IS_SELECTED 1
......@@ -32,10 +30,9 @@
#define DANGLING_SYMBOL_SIZE 12
/* Message de presentation */
extern wxString g_DefaultSchematicFileName;
/* Masque de recherche pour localisation d'objets a editer */
/* Search mask for locating objects in editor. */
#define LIBITEM 1
#define WIREITEM 2
#define BUSITEM 4
......@@ -53,12 +50,13 @@ extern wxString g_DefaultSchematicFileName;
#define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000
#define WIRE_BUS_ENDPOINTS_ONLY 0x8000
#define SEARCHALL LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | JUNCTIONITEM \
| DRAWITEM | TEXTITEM | LABELITEM | SHEETITEM | MARKERITEM \
| NOCONNECTITEM | SEARCH_PINITEM | SHEETLABELITEM
#define SEARCHALL ( LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | \
JUNCTIONITEM | DRAWITEM | TEXTITEM | LABELITEM | \
SHEETITEM | MARKERITEM | NOCONNECTITEM | \
SEARCH_PINITEM | SHEETLABELITEM )
/* Numero des couches de travail */
typedef enum {
typedef enum
{
LAYER_WIRE,
LAYER_BUS,
LAYER_JUNCTION,
......@@ -84,39 +82,44 @@ typedef enum {
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
MAX_LAYER /* Nombre de couches */
MAX_LAYER /* Maximum layers */
} LayerNumber;
typedef enum {
typedef enum
{
FILE_SAVE_AS,
FILE_SAVE_NEW
} FileSaveType;
/* variables generales */
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
* les numeros (netlist PSPICE seulement) */
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
* dessinee pouvant etre dupliquee par la commande
* Repeat ( NULL si aucune struct existe ) */
extern int g_OptNetListUseNames; /* TRUE to use names rather than
* net numbers (PSPICE netlist
* only) */
extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
* by the repeat command. NULL if no
* item to repeat */
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo managing to restore old values ) */
* before it is modified (used for undo
* managing to restore old values ) */
extern bool g_LastSearchIsMarker; // True if last seach is a marker serach
// False for a schematic item search
// Used for hotkey next search
extern bool g_LastSearchIsMarker; /* True if last search is a marker
* search. False for a schematic
* item search. Used for hotkey
* next search. */
/* Block operation (copy, paste) */
extern BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created
* by Block Save) */
// Gestion d'options
// Management options.
extern bool g_HVLines;
// Gestion de diverses variables, options... devant etre memorisees mais
// Remises a 0 lors d'un rechargement de projetc
// Management variables, option ... to be stored. Reset to 0 during a
// project reload.
struct EESchemaVariables
{
int NbErrorErc;
......@@ -125,40 +128,19 @@ struct EESchemaVariables
extern struct EESchemaVariables g_EESchemaVar;
/* Variables globales pour Schematic Edit */
extern int g_DefaultTextLabelSize;
/********************************************************/
/* Description des structures des parametres principaux */
/********************************************************/
/* Gestion des trace sur table tracante */
/* For HPGL plotting: Pen caract : */
struct HPGL_Pen_Descr_Struct
{
int m_Pen_Num; /* num de plume a charger */
int m_Pen_Speed; /* vitesse en cm/s */
int m_Pen_Num; /* Pen number */
int m_Pen_Speed; /* Pen speed in cm/s */
int m_Pen_Diam; /* Pen diameter in mils */
};
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* First and main (root) screen */
extern DrawSheetStruct* g_RootSheet;
/*************************************/
/* Gestion de recherche des elements */
/*************************************/
/* valeur de flag indicant si le pointeur de reference pour une localisation
* est le curseur sur grille ou le curseur a deplacement fin hors grille */
#define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1
extern SCH_SHEET* g_RootSheet;
/* Gestion des librairies schematiques */
extern wxString g_NetCmpExtBuffer;
extern const wxString SymbolFileExtension;
......@@ -167,23 +149,28 @@ extern const wxString SymbolFileWildcard;
extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard;
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_SimulatorCommandLine;
extern wxString g_NetListerCommandLine;
extern LayerStruct g_LayerDescr; /* couleurs des couches */
extern LayerStruct g_LayerDescr;
extern bool g_EditPinByPinIsOn; /* true to do not synchronize pins edition
* when they are at the same location */
extern bool g_EditPinByPinIsOn; /* True to prevent displacing
* pins, when they are at the
* same position. */
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ).
* 0 = single pixel line width
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA
* units) thickness used to
* draw/plot items having a
* default thickness line
* value (i.e. = 0 ).
* 0 = single pixel line width
*/
// Color to draw selected items
extern int g_ItemSelectetColor;
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
// Color to draw items flagged invisible, in libedit (they are invisible in
// eeschema
extern int g_InvisibleItemColor;
#endif // _GENERAL_H_
......@@ -20,11 +20,9 @@
#include <boost/foreach.hpp>
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC );
/* Variables locales */
static int OldTransMat[2][2];
static wxPoint OldPos;
......@@ -200,7 +198,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
GetScreen()->m_Curseur, true );
// Set the component value (that can differ from component name in lib, for aliases)
// Set the component value (that can differ from component name in lib,
// for aliases)
Component->GetField( VALUE )->m_Text = Name;
Component->DisplayInfo( this );
......@@ -210,10 +209,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
}
/**************************************************************************/
/*** Routine de deplacement du composant. ***/
/*** Appele par GeneralControle grace a ActiveScreen->ManageCurseur. ***/
/**************************************************************************/
/**
* Move a component.
*/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint move_vector;
......@@ -222,7 +220,6 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
/* Effacement du composant */
if( erase )
{
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
......@@ -236,8 +233,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*
* Routine permettant les rotations et les miroirs d'un composant
* Si DC = NULL : pas de redessin
* Routine to rotate and mirror a component.
*
** If DC == NULL: no repaint
*/
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate )
......@@ -245,7 +243,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
/* Efface le trace precedent */
/* Deletes the previous component. */
if( DC )
{
DrawPanel->CursorOff( DC );
......@@ -259,7 +257,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
DrawComponent->SetRotationMiroir( type_rotate );
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DC )
{
if( DrawComponent->m_Flags )
......@@ -276,7 +274,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
/*
* Routine de sortie de la fonction de placement de composant
* Abort a place component command in progress.
*/
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
{
......@@ -284,12 +282,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
if( Component->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
if( Component->m_Flags & IS_NEW )
{
Component->m_Flags = 0;
SAFE_DELETE( Component );
}
else if( Component ) /* Deplacement ancien composant en cours */
else if( Component )
{
wxPoint move_vector = OldPos - Component->m_Pos;
Component->Move( move_vector );
......@@ -305,7 +303,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/*
* Selection de l'unite dans les boitiers a multiples Parts
* Handle select part in multi-part component.
*/
void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC )
......@@ -333,17 +331,16 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( unit > m_UnitCount )
unit = m_UnitCount;
/* Efface le trace precedent */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
/* Mise a jour du numero d'unite */
/* Update the unit number. */
DrawComponent->SetUnitSelection( GetSheet(), unit );
DrawComponent->m_Multi = unit;
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -374,7 +371,6 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
return;
}
/* Efface le trace precedent */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -390,7 +386,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Convert > 2 )
DrawComponent->m_Convert = 1;
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -432,9 +428,9 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
#if 1
// switch from normal mode to xor mode for the duration of the move, first
// by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(),
// then by drawing the first time in xor mode so that subsequent xor
// drawing modes will fully erase this first copy.
// by erasing fully any "normal drawing mode" primitives with the
// PostDirtyRect(), then by drawing the first time in xor mode so that
// subsequent xor drawing modes will fully erase this first copy.
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
......
/************************************************************************/
/* hierarch.cpp: Gestion de la hierarchie: navigation dans les feuilles */
/************************************************************************/
/******************/
/* hierarch.cpp */
/******************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -18,15 +18,16 @@
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
enum {
enum
{
ID_TREECTRL_HIERARCHY = 1600
};
class WinEDA_HierFrame;
/* This class derived from wxTreeItemData stores the DrawSheetPath of each sheet in hierarcy
* in each TreeItem, in its associated data buffer
/* This class derived from wxTreeItemData stores the DrawSheetPath of each
* sheet in hierarchy in each TreeItem, in its associated data buffer
*/
class TreeItemData : public wxTreeItemData
{
......@@ -38,7 +39,7 @@ public:
}
};
/* Classe de l'arbre de hierarchie */
/* Class to handle hierarchy tree. */
class WinEDA_Tree : public wxTreeCtrl
{
private:
......@@ -71,7 +72,6 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
}
/* Classe definissant la fenetre d'affichage de la hierarchie */
class WinEDA_HierFrame : public wxDialog
{
public:
......@@ -81,7 +81,7 @@ public:
wxDC* m_DC;
private:
wxSize m_TreeSize; // Taille de l'arbre de hierarchie
wxSize m_TreeSize;
int maxposx;
public:
......@@ -153,7 +153,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC,
{
m_Tree->Expand( cellule );
// Reajustage de la taille de la frame a une valeur optimale
// Readjust the size of the frame to an optimal value.
m_TreeSize.y += m_nbsheets * itemrect.GetHeight();
m_TreeSize.x = MIN( m_TreeSize.x, 250 );
m_TreeSize.y = MIN( m_TreeSize.y, 350 );
......@@ -176,15 +176,13 @@ void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
}
/********************************************************************/
/* Routine to create the tree in the navigation hierarchy
* Schematic
* This routine is re-entrant!
*/
void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
wxTreeItemId* previousmenu )
/********************************************************************/
wxTreeItemId* previousmenu )
/* Routine de creation de l'arbre de navigation dans la hierarchy
* schematique
* Cette routine est Reentrante !
*/
{
wxTreeItemId menu;
......@@ -206,7 +204,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
{
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
m_nbsheets++;
menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
list->Push( sheet );
......@@ -236,13 +234,11 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
}
/***************************************************/
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
/***************************************************/
/* Called on a double-click on a tree item:
* Open the selected sheet, and display the corresponding screen
* Open the selected sheet, and display the corresponding screen
*/
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
{
wxTreeItemId ItemSel = m_Tree->GetSelection();
......@@ -253,12 +249,10 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
}
/******************************************************/
void WinEDA_SchematicFrame::InstallPreviousSheet()
/******************************************************/
/* Set the current screen to display the parent sheet of the current displayed sheet
/* Set the current screen to display the parent sheet of the current
* displayed sheet
*/
void WinEDA_SchematicFrame::InstallPreviousSheet()
{
if( m_CurrentSheet->Last() == g_RootSheet )
return;
......@@ -279,16 +273,13 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
}
/*********************************************************************/
void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
/*********************************************************************/
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
* par la souris
* have to be careful here because the DrawSheetStructs within the EEDrawList
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the m_SubSheet hierarchy
* to maintain path info (well, this is but one way to maintain path info..)
/* Routine installation of the screen corresponding to the symbol edge Sheet
* Be careful here because the SCH_SHEETs within the EEDrawList
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the
* m_SubSheet hierarchy to maintain path info (well, this is but one way to
* maintain path info..)
*/
void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet )
{
if( Sheet == NULL )
{
......@@ -301,14 +292,10 @@ void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
}
/**************************************************************/
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
/**************************************************************/
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
* Si Sheet == NULL installation de l'ecran de base ( Root ).
/* Find and install the screen on the sheet symbol Sheet.
* If Sheet == NULL installation of the screen base (Root).
*/
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
{
SCH_SCREEN* NewScreen;
......@@ -319,8 +306,8 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
return false;
}
// Reinit des parametres d'affichage du nouvel ecran
// assumes m_CurrentSheet has already been updated.
// Reset display settings of the new screen
// Assumes m_CurrentSheet has already been updated.
frame->ClearMsgPanel();
frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
NewScreen->m_ZoomScalar,
......
......@@ -2,9 +2,9 @@
/* EESchema - lib_export.cpp */
/*****************************/
/* Routines de maintenanace des librariries:
* sauvegarde, modification de librairies.
* creation edition suppression de composants
/* Library maintenance routines.
* Backup modified libraries.
* Create, edit, and delete components.
*/
#include "fctsys.h"
......@@ -27,13 +27,11 @@
extern int ExportPartId;
/*************************************************/
/* Routine de lecture de 1 description.
* Le format est celui des librairies, mais on ne charge que 1 composant
* ou le 1er composant s'il y en a plusieurs.
* Si le premier composant est un alias, on chargera la racine correspondante
/* Routine to read one part.
* The format is that of libraries, but it loads only 1 component.
* Or 1 component if there are several.
* If the first component is an alias, it will load the corresponding root.
*/
/*************************************************/
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{
wxString errMsg;
......@@ -82,12 +80,12 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
}
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
* composant courant dans cette librarie
* si create_lib == TRUE sauvegarde dans le repertoire des libr
* sinon: sauvegarde sous le nom demande sans modifications.
/* Routine to create a new library and backup the current component in
* this library.
* Create_lib == TRUE if the backup directory of library.
* If not: backup as the request without modifications.
*
* Le format du fichier cree est dans tous les cas le meme.
* The file format is created in all cases the same.
*/
void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
{
......
/**************************************************************/
/* libarch.cc */
/* Module de generation du fichier d'archivage des composants */
/**************************************************************/
/*****************************************************/
/* libarch.cpp */
/* Module for generation of component archive files. */
/*****************************************************/
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
......@@ -29,7 +29,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
libCache->SetCache();
/* examine all screens (not scheets) used and build the list of components
/* examine all screens (not sheets) used and build the list of components
* found in lib complex hierarchies are not a problem because we just want
* to know used components in libraries
*/
......@@ -52,7 +52,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
if( !libCache->Save( ArchFullFileName ) )
{
msg.Printf( _( "An error occurrred attempting to save component \
msg.Printf( _( "An error occurred attempting to save component \
library <%s>." ), GetChars( ArchFullFileName ) );
DisplayError( frame, msg );
return false;
......
......@@ -2,11 +2,6 @@
/* EESchema - libedit.cpp */
/****************************/
/* Routines de maintenanace des librairies:
* sauvegarde, modification de librairies.
* creation edition suppression de composants
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
......@@ -118,11 +113,11 @@ library \"%s\"." ),
/*
* Routine Pour Charger en memoire la copie de 1 libpart.
* retourne
* 0 si OK
* 1 si err
* m_component pointe la copie ainsi creee
* Routine to load into memory a copy of 1 library part.
* Returns
* 0 if OK
* 1 if error
* m_component advanced copy and created
*/
bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
CMP_LIBRARY* Library )
......@@ -208,7 +203,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DC->SetBackgroundMode( wxTRANSPARENT );
GRResetPenAndBrush( DC );
DrawPanel->CursorOff( DC ); // erase cursor
DrawPanel->CursorOff( DC );
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, DC, false );
......@@ -289,8 +284,9 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
/*
* Affiche la documentation du composant selectionne
* Utilise lors de l'affichage de la liste des composants en librairie
* Display the documentation of the selected component.
*
* Used when displaying the list of library components.
*/
void WinEDA_LibeditFrame::DisplayCmpDoc()
{
......@@ -354,16 +350,18 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
/*
* Routine de suppression d'un composant dans la librairie courante
* (effacement en memoire uniquement, le fichier n'est pas modifie)
* Le composant peut etre un alias, ou la definition de base.
* Si c'est un alias:
* il est supprime, et la liste des alias de la definition
* de base est modifiee
* Si c'est le composant de base:
* Si la liste des alias est nulle, il est supprime
* Sinon le premier alias devient le composant de base, et les autres
* alias deviennent dependants de celui ci.
* Delete component in the current library.
*
* (Delete only in memory, the file does not change)
*
* The entry can be an alias or a component.
* If an alias:
* It is removed, and the list of alias is updated.
*
* If a component:
* If the list of aliases is zero, it deletes the component
* Otherwise the alias becomes the new component name, and the other
* aliases become dependent on newly named component.
*/
void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
{
......@@ -515,7 +513,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
name = dlg.GetName().MakeUpper();
name.Replace( wxT( " " ), wxT( "_" ) );
/* Test: y a t-il un composant deja de ce nom */
/* Test if there a component with this name already. */
if( m_library && m_library->FindEntry( name ) )
{
wxString msg;
......@@ -570,11 +568,11 @@ lost!\n\nClear the current component from the screen?" ) ) )
/*
* Routine de sauvegarde de la "partlib" courante dans la librairie courante
* Routine backup of "partlib" current in the current library.
*
* Sauvegarde en memoire uniquement, et PAS sur fichier
* La routine efface l'ancien composant ( ou / et les alias ) a remplacer
* s'il existe, et sauve le nouveau et cree les alias correspondants.
* Save in memory only and NOT on file.
* The routine deletes the old component (and / or aliases) to replace
* If any, and saves the new and creates the corresponding alias.
*/
void WinEDA_LibeditFrame::SaveOnePartInMemory()
{
......
/*********************************************************************/
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
/*********************************************************************/
/*****************************************************/
/* Component library edit field manipulation code. */
/*****************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -15,11 +15,9 @@
#include "class_library.h"
/* Routines locales */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */
extern int m_unit;
static wxPoint StartCursor, LastTextPosition;
......@@ -49,9 +47,6 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
}
/*
* Initialise le deplacement d'un champ ( ref ou Name )
*/
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
{
wxPoint startPos;
......@@ -78,10 +73,10 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
}
/*****************************************************************/
/* Routine d'affichage du texte 'Field' en cours de deplacement. */
/* Routine normalement attachee au curseur */
/*****************************************************************/
/*
* Routine to display text 'Field' on the move.
* Normally called by cursor management code.
*/
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
......@@ -228,9 +223,10 @@ not conflict with any library entries." ),
/*
* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
* si un champ est en cours d'edition, modif de celui ci.
* sinon Modif du champ pointe par la souris
* Rotate a field horizontally or vertically.
*
* If a field is being edited, rotate.
* Otherwise rotate the field at the current cursor position.
*/
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
{
......
......@@ -148,30 +148,30 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style )
{
m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis
m_Draw_Grid = true; // true to draw grid
m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis
m_Draw_Grid = true; // true to draw grid
m_ConfigPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
m_drawSpecificConvert = true;
m_drawSpecificUnit = false;
m_drawSpecificUnit = false;
// Give an icon
SetIcon( wxIcon( libedit_xpm ) );
SetBaseScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true;
LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
......@@ -189,32 +189,33 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
Show( true );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
wxAuiPaneInfo vert(horiz);
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
m_auimgr.AddPane(m_VToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
m_auimgr.AddPane(DrawPanel,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
m_auimgr.AddPane(MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......@@ -224,6 +225,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
{
WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL;
}
......@@ -288,8 +290,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
GetScreen()->ClrModify();
}
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{
BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) {
if( lib.IsModified() )
{
wxString msg;
......@@ -351,8 +352,8 @@ int WinEDA_LibeditFrame::BestZoom()
}
size -= wxSize( 25, 25 ); // reserve 100 mils margin
ii = wxRound( ( (double) dx / (double) size.x ) *
(double) GetScreen()->m_ZoomScalar );
ii = wxRound( ( (double) dx / (double) size.x ) *
(double) GetScreen()->m_ZoomScalar );
jj = wxRound( ( (double) dy / (double) size.y ) *
(double) GetScreen()->m_ZoomScalar );
......@@ -495,8 +496,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
if( m_HToolBar == NULL )
return;
event.Enable( GetShowDeMorgan() ||
(m_component && m_component->HasConversion()) );
event.Enable( GetShowDeMorgan()
|| ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
}
......@@ -506,8 +507,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
if( m_HToolBar == NULL )
return;
event.Enable( GetShowDeMorgan() ||
(m_component && m_component->HasConversion()) );
event.Enable( GetShowDeMorgan()
|| ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
}
......@@ -521,7 +522,7 @@ void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event )
* so use the pointer to alias combobox to directly enable or disable.
*/
m_SelAliasBox->Enable( m_component != NULL
&& !m_component->m_AliasList.IsEmpty() );
&& !m_component->m_AliasList.IsEmpty() );
}
......@@ -533,7 +534,8 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
m_lastDrawItem = NULL;
if( m_SelAliasBox->GetStringSelection().CmpNoCase(m_component->GetName() ) == 0 )
if( m_SelAliasBox->GetStringSelection().CmpNoCase( m_component->GetName() )
== 0 )
m_aliasName.Empty();
else
m_aliasName = m_SelAliasBox->GetStringSelection();
......@@ -710,7 +712,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol( );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
......@@ -767,6 +769,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
// Delete the last created segment, while creating a polyline draw item
if( m_drawItem == NULL )
break;
......
......@@ -27,7 +27,7 @@ private:
// Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_ConfigPath; // subpath for configuartion
wxString m_ConfigPath; // subpath for configuration
public:
WinEDA_ViewlibFrame( wxWindow* father,
......@@ -47,7 +47,7 @@ public:
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom
int BestZoom();
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
......
/****************************************/
/* Module to load/save EESchema files. */
/* Module to load/save EESchema files. */
/****************************************/
#include "fctsys.h"
......@@ -29,7 +29,6 @@ extern int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
wxString& aMsgDiag, int* aLineNum,
BASE_SCREEN* Window );
/* Fonctions locales */
static void LoadLayers( FILE* f, int* linecnt );
......@@ -118,7 +117,8 @@ again." );
}
// Read the rest of a potentially very long line. fgets() puts a '\n' into
// the buffer if the end of line was reached. Read until end of line if necessary.
// the buffer if the end of line was reached. Read until end of line if
// necessary.
if( Line[ strlen( Line )-1 ] != '\n' )
{
int c;
......@@ -136,7 +136,7 @@ again." );
switch( Line[0] )
{
case '$': /* identification de bloc */
case '$': /* identification block */
if( Line[1] == 'C' )
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
screen );
......@@ -148,32 +148,32 @@ again." );
else if( Line[1] == 'D' )
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount,
screen );
else if( Line[1] == 'T' ) //text part
{
printf("**** TEXT PART\n");
SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
&LineCount, version);
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
}
else
Failed = true;
}
else if( Line[1] == 'T' ) //text part
{
printf("**** TEXT PART\n");
SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
&LineCount, version);
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
}
else
Failed = true;
}
break;
case 'L': /* Its a library item. */
case 'L': /* Its a library item. */
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
break; /* Fin lecture 1 composant */
break;
case 'W': /* Its a Segment (WIRE or BUS) item. */
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
{
MsgDiag.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
MsgDiag.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
LineCount );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
Failed = true;
......@@ -209,7 +209,7 @@ again." );
break;
case 'E': /* Its a Raccord (WIRE or BUS) item. */
case 'E': /* Its a WIRE or BUS item. */
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
{
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
......@@ -325,7 +325,8 @@ at line %d, aborted" ),
break;
case 'K': /* It is a Marker item. */
// Markers are no more read from file. they are only created on demand in schematic
// Markers are no more read from file. they are only created on
// demand in schematic
break;
case 'T': /* It is a text item. */
......@@ -398,7 +399,7 @@ static void LoadLayers( FILE* f, int* linecnt )
sscanf( Line, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
if( strcmp( Name, "EELAYER" ) !=0 )
{
/* error : init par defaut */
/* error : init par default */
Number = MAX_LAYER;
}
......
......@@ -14,9 +14,9 @@
#include "class_library.h"
/* Routines Locales */
static bool DrawStructInBox( int x1, int y1, int x2, int y2,
SCH_ITEM *DrawStruct );
SCH_ITEM* DrawStruct );
static SCH_ITEM* LastSnappedStruct = NULL;
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 );
......@@ -43,10 +43,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
while( DrawList )
{
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
DrawList, Screen->GetZoom() ) ) == FALSE )
DrawList, Screen->GetZoom() ) ) == FALSE )
{
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
break;
}
component = (SCH_COMPONENT*) LastSnappedStruct;
......@@ -55,12 +55,14 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
{
lastcomponent = component;
BoundaryBox = lastcomponent->GetBoundaryBox();
sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
sizeref = ABS( (float) BoundaryBox.GetWidth() *
BoundaryBox.GetHeight() );
}
else
{
BoundaryBox = component->GetBoundaryBox();
sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
sizecurr = ABS( (float) BoundaryBox.GetWidth() *
BoundaryBox.GetHeight() );
if( sizeref > sizecurr ) // a smallest component is found
{
sizeref = sizecurr;
......@@ -73,10 +75,12 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
}
/********************************************************************************/
SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask )
/******************************************************************************/
SCH_ITEM* PickStruct( const wxPoint& refpos,
BASE_SCREEN* screen,
int SearchMask )
{
/******************************************************************************/
/* Search an item at pos refpos
* SearchMask = (bitwise OR):
* LIBITEM
......@@ -94,9 +98,9 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
* SHEETLABELITEM
* FIELDCMPITEM
*
* if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
* if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire or bus search and locate,
* start and end points are not included in search
* if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
* if WIRE_BUS_ENDPOINTS_ONLY is set, in wire or bus search and locate,
* only start and end points are included in search
*
*
......@@ -104,7 +108,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
* pointer on item found or NULL
*
*/
{
bool Snapped;
if( screen == NULL || screen->EEDrawList == NULL )
......@@ -120,7 +123,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
}
/** Function PickStruct
* Search items in a block
* @return items count
......@@ -146,18 +148,19 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
EXCHG( y, OrigY );
ITEM_PICKER picker;
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
{
/* Put this structure in the picked list: */
picker.m_PickedItem = DrawStruct;
picker.m_PickedItem = DrawStruct;
picker.m_PickedItemType = DrawStruct->Type();
aBlock.PushItem(picker);
aBlock.PushItem( picker );
itemcount++;
}
}
return itemcount;
}
......@@ -175,7 +178,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
{
for( ; DrawList != NULL; DrawList = DrawList->Next() )
{
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ;
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 );
switch( DrawList->Type() )
{
case DRAW_POLYLINE_STRUCT_TYPE:
......@@ -187,7 +190,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
for( unsigned i = 0; i < STRUCT->GetCornerCount() - 1; i++ )
{
if( TestSegmentHit( aPosRef, STRUCT->m_PolyPoints[i],
STRUCT->m_PolyPoints[i + 1], hitminDist ) )
STRUCT->m_PolyPoints[i + 1], hitminDist ) )
{
LastSnappedStruct = DrawList;
return TRUE;
......@@ -204,14 +207,18 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
{
if( ( (SearchMask & DRAWITEM) && (STRUCT->GetLayer() == LAYER_NOTES) )
|| ( (SearchMask & WIREITEM) && (STRUCT->GetLayer() == LAYER_WIRE) )
|| ( (SearchMask & BUSITEM) && (STRUCT->GetLayer() == LAYER_BUS) )
if( ( (SearchMask & DRAWITEM)
&& (STRUCT->GetLayer() == LAYER_NOTES) )
|| ( (SearchMask & WIREITEM)
&& (STRUCT->GetLayer() == LAYER_WIRE) )
|| ( (SearchMask & BUSITEM)
&& (STRUCT->GetLayer() == LAYER_BUS) )
)
{
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
{
if( aPosRef == STRUCT->m_Start || aPosRef == STRUCT->m_End )
if( aPosRef == STRUCT->m_Start || aPosRef ==
STRUCT->m_End )
break;
}
......@@ -234,7 +241,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
if( !( SearchMask & (RACCORDITEM) ) )
break;
if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(), hitminDist ) )
if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(),
hitminDist ) )
{
LastSnappedStruct = DrawList;
return TRUE;
......@@ -271,7 +279,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
#define STRUCT ( (MARKER_SCH*) DrawList )
if( !(SearchMask & MARKERITEM) )
break;
if( STRUCT->HitTest(aPosRef) )
if( STRUCT->HitTest( aPosRef ) )
{
LastSnappedStruct = DrawList;
return TRUE;
......@@ -296,7 +304,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
#undef STRUCT
#define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base class of these labels
#define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base
// class of these labels
if( !(SearchMask & LABELITEM) )
break;
if( STRUCT->HitTest( aPosRef ) )
......@@ -346,7 +355,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList )
#define STRUCT ( (SCH_SHEET*) DrawList )
if( !(SearchMask & SHEETITEM) )
break;
if( STRUCT->HitTest( aPosRef ) )
......@@ -359,7 +368,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
default:
{
wxString msg;
msg.Printf( wxT( "SnapPoint2() error: unexpected struct type %d (" ), DrawList->Type() );
msg.Printf( wxT( "SnapPoint2() error: unexpected struct type %d (" ),
DrawList->Type() );
msg << DrawList->GetClass() << wxT( ")" );
wxMessageBox( msg );
break;
......@@ -389,8 +399,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
{
if( STRUCT->m_PolyPoints[i].x >= x1 && STRUCT->m_PolyPoints[i].x <= x2
&& STRUCT->m_PolyPoints[i].y >= y1 && STRUCT->m_PolyPoints[i].y <=y2 )
if( STRUCT->m_PolyPoints[i].x >= x1
&& STRUCT->m_PolyPoints[i].x <= x2
&& STRUCT->m_PolyPoints[i].y >= y1
&& STRUCT->m_PolyPoints[i].y <=y2 )
return TRUE;
}
......@@ -480,8 +492,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
case TYPE_SCH_GLOBALLABEL:
#undef STRUCT
#define STRUCT ( (SCH_LABEL*) DrawStruct )
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* total length */
dy = STRUCT->m_Size.y / 2; /* half height */
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* total length
**/
dy = STRUCT->m_Size.y / 2; /* half height
**/
xt1 = xt2 = STRUCT->m_Pos.x;
yt1 = yt2 = STRUCT->m_Pos.y;
......@@ -524,7 +538,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawStruct )
#define STRUCT ( (SCH_SHEET*) DrawStruct )
/* Recalculate the coordinates of the worksheet component */
xt1 = STRUCT->m_Pos.x;
yt1 = STRUCT->m_Pos.y;
......@@ -539,9 +553,8 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
break;
default:
msg.Printf(
wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
DrawStruct->Type() );
msg.Printf( wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
DrawStruct->Type() );
msg << DrawStruct->GetClass() << wxT( ")" );
wxMessageBox( msg );
break;
......@@ -554,8 +567,8 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
/****************************************************************************/
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 )
{
/****************************************************************************/
/* Routine detects that the rectangle 1 (Box1) and the rectangle 2 (Box2) is
* Overlap.
* Returns TRUE or FALSE.
......@@ -563,7 +576,6 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
* These assume that there is recovery if at least one corner
* A 'Box' is included in the other
*/
{
int cX, cY;
if( StartX1 > EndX1 )
......@@ -621,11 +633,10 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
}
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
const wxPoint& pos )
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos )
{
int size, dy, minx, maxx;
Hierarchical_PIN_Sheet_Struct* SheetLabel;
SCH_SHEET_PIN* SheetLabel;
SheetLabel = Sheet->m_Label;
while( SheetLabel
......@@ -658,7 +669,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
LIB_PIN* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL;
DrawStruct = DrawStruct->Next() )
DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue;
......@@ -667,7 +678,8 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
if( Entry == NULL )
continue;
/* we use LocateDrawItem to locate pns. but this function suppose a
/* we use LocateDrawItem to locate pins. but this function suppose a
* component.
* at 0,0 location
* So we must calculate the ref position relative to the component
......@@ -687,20 +699,18 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
}
Hierarchical_PIN_Sheet_Struct* LocateAnyPinSheet( const wxPoint& RefPos,
SCH_ITEM* DrawList )
SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList )
{
SCH_ITEM* DrawStruct;
Hierarchical_PIN_Sheet_Struct* PinSheet = NULL;
SCH_SHEET_PIN* PinSheet = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL;
DrawStruct = DrawStruct->Next() )
DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
continue;
PinSheet = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
RefPos );
PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos );
if( PinSheet )
break;
}
......
/*******************************************************/
/* Module de generation de la Netliste , selon Formats */
/*******************************************************/
/*****************************/
/* Net list generation code. */
/*****************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -17,9 +17,8 @@
#include "class_library.h"
/* Routines locales */
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
const wxString& FullFileName );
const wxString& FullFileName );
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
bool with_pcbnew );
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f );
......@@ -50,12 +49,11 @@ static wxArrayString s_ReferencesAlreadyFound;
/******************************************************************************/
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
bool use_netnames )
{
/*******************************************************************************/
/* Create the netlist file ( Format is given by frame->m_NetlistFormat )
* bool use_netnames is used only for Spice netlist
*/
{
FILE* f = NULL;
if( frame->m_NetlistFormat < NET_TYPE_CUSTOM1 )
......@@ -106,12 +104,13 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
* considered)
* Must be deallocated by the user
*/
static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList,
DrawSheetPath* sheet )
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
EDA_BaseStruct* DrawList,
DrawSheetPath* sheet )
{
SCH_COMPONENT* Component = NULL;
LIB_COMPONENT* Entry;
LIB_PIN* Pin;
LIB_PIN* Pin;
s_SortedComponentPinList.clear();
for( ; DrawList != NULL; DrawList = DrawList->Next() )
......@@ -120,8 +119,8 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
continue;
Component = (SCH_COMPONENT*) DrawList;
/* Power symbol and other component which have the reference starting by
* "#" are not included in netlist (pseudo or virtual components) */
/* Power symbol and other component which have the reference starting
* by "#" are not included in netlist (pseudo or virtual components) */
wxString str = Component->GetRef( sheet );
if( str[0] == '#' ) // ignore it
continue;
......@@ -141,7 +140,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
if( Entry->GetPartCount() > 1 )
{
bool found = false;
for( unsigned jj = 0; jj < s_ReferencesAlreadyFound.GetCount(); jj++ )
for( unsigned jj = 0;
jj < s_ReferencesAlreadyFound.GetCount();
jj++ )
{
if( str == s_ReferencesAlreadyFound[jj] ) // Already visited
{
......@@ -174,7 +175,8 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
AddPinToComponentPinList( Component, sheet, Pin );
}
}
else // Multiple parts per package: Collect all parts ans pins for this reference
else // Multiple parts per package: Collect all parts ans pins for
// this reference
FindAllsInstancesOfComponent( Component, Entry, sheet );
/* Sort Pins in s_SortedComponentPinList by pin number */
......@@ -191,17 +193,14 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
}
/**************************************************************************************/
static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
const wxString& DefaultFormatNetname )
/**************************************************************************************/
/* Return the net name for the pin Pin.
* Net name is:
* "?" if pin not connected
* "netname" for global net (like gnd, vcc ..
* "netname_sheetnumber" for the usual nets
*/
static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
const wxString& DefaultFormatNetname )
{
int netcode = Pin->GetNet();
wxString NetName;
......@@ -233,7 +232,7 @@ static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
wxString lnet = NetName;
NetName = g_NetObjectslist[jj]->m_SheetList.PathHumanReadable();
// If sheet path is too long, use the time stamp name insteed
// If sheet path is too long, use the time stamp name instead
if( NetName.Length() > 32 )
NetName = g_NetObjectslist[jj]->m_SheetList.Path();
NetName += lnet;
......@@ -248,14 +247,11 @@ static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
}
/***********************************************************************/
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
const wxString& FullFileName )
/***********************************************************************/
/* Create a generic netlist, and call an external netlister
* to change the netlist syntax and create the file
*/
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
const wxString& FullFileName )
{
wxString Line, FootprintName;
DrawSheetPath* sheet;
......@@ -274,21 +270,27 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
return;
}
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
* files*/
fprintf( tmpfile, "$BeginNetlist\n" );
/* Create netlist module section */
fprintf( tmpfile, "$BeginComponentList\n" );
EDA_SheetList SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
for( SchItem = sheet->LastDrawList(); SchItem != NULL; SchItem = SchItem->Next() )
for( SchItem = sheet->LastDrawList();
SchItem != NULL;
SchItem = SchItem->Next() )
{
SchItem = Component = FindNextComponentAndCreatPinList( SchItem, sheet );
SchItem = Component = FindNextComponentAndCreatPinList( SchItem,
sheet );
if( Component == NULL )
break; // No component left
break; // No component left
FootprintName.Empty();
if( !Component->GetField( FOOTPRINT )->IsVoid() )
......@@ -300,7 +302,8 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
fprintf( tmpfile, "\n$BeginComponent\n" );
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT( "\n" );
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT(
"\n" );
Line.Replace( wxT( " " ), wxT( "_" ) );
fputs( CONV_TO_UTF8( Line ), tmpfile );
......@@ -357,30 +360,25 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
}
/**********************************/
static void ClearUsedFlags( void )
/*********************************/
/* Clear flag list, used in netlist generation */
static void ClearUsedFlags( void )
{
s_ReferencesAlreadyFound.Clear();
}
/*************************************************************/
static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
bool use_netnames )
/*************************************************************/
/* Routine de generation du fichier netliste ( Format PSPICE )
* si use_netnames = TRUE
* les nodes sont identifies par le netname
* sinon les nodes sont identifies par le netnumber
/* Routine generation of the netlist file (Format PSPICE)
* = TRUE if use_netnames
* Nodes are identified by the netname
* If the nodes are identified by the netnumber
*
* tous les textes graphiques commen�ant par [.-+]pspice ou [.-+]gnucap
* sont consideres comme des commandes a placer dans la netliste
* [.-]pspice ou gnucap sont en debut
* +pspice et +gnucap sont en fin de netliste
* All graphics text commentary by a [.-+] PSpice or [.-+] gnucap
* Are considered in placing orders in the netlist
* [.-] Or PSpice gnucap are beginning
* + + Gnucap and PSpice are ultimately NetList
*/
static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
bool use_netnames )
{
char Line[1024];
DrawSheetPath* sheet;
......@@ -395,16 +393,24 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
wxChar bufnum[BUFYPOS_LEN + 1];
DateAndTime( Line );
fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line );
/* Create text list starting by [.-]pspice , or [.-]gnucap (simulator commands) */
/* and create text list starting by [+]pspice , or [+]gnucap (simulator commands) */
fprintf( f,
"* %s (Spice format) creation date: %s\n\n",
NETLIST_HEAD_STRING,
Line );
/* Create text list starting by [.-]pspice , or [.-]gnucap (simulator
* commands) and create text list starting by [+]pspice , or [+]gnucap
* (simulator commands) */
bufnum[BUFYPOS_LEN] = 0;
EDA_SheetList SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
for( DrawList = sheet->LastDrawList();
DrawList != NULL;
DrawList = DrawList->Next() )
{
wxChar ident;
if( DrawList->Type() != TYPE_SCH_TEXT )
......@@ -415,21 +421,23 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
ident = text.GetChar( 0 );
if( ident != '.' && ident != '-' && ident != '+' )
continue;
text.Remove( 0, 1 ); //Remove the first char.
text.Remove( 6 ); //text contains 6 char.
text.Remove( 0, 1 ); // Remove the first char.
text.Remove( 6 ); // text contains 6 char.
text.MakeLower();
if( ( text == wxT( "pspice" ) ) || ( text == wxT( "gnucap" ) ) )
{
/* Put the Y position as an ascii string, for sort by vertical position,
* using usual sort string by alphabetic value */
/* Put the Y position as an ascii string, for sort by vertical
* position, using usual sort string by alphabetic value */
int ypos = DRAWTEXT->m_Pos.y;
for( int ii = 0; ii < BUFYPOS_LEN; ii++ )
{
bufnum[BUFYPOS_LEN - 1 - ii] = (ypos & 63) + ' '; ypos >>= 6;
bufnum[BUFYPOS_LEN - 1 -
ii] = (ypos & 63) + ' '; ypos >>= 6;
}
text = DRAWTEXT->m_Text.AfterFirst( ' ' );
msg.Printf( wxT( "%s %s" ), bufnum, text.GetData() ); // First BUFYPOS_LEN char are the Y position
// First BUFYPOS_LEN char are the Y position.
msg.Printf( wxT( "%s %s" ), bufnum, text.GetData() );
if( ident == '+' )
SpiceCommandAtEndFile.Add( msg );
else
......@@ -438,7 +446,8 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
}
}
/* Print texts starting by [.-]pspice , ou [.-]gnucap (of course, without the Y position string)*/
/* Print texts starting by [.-]pspice , ou [.-]gnucap (of course, without
* the Y position string)*/
nbitems = SpiceCommandAtBeginFile.GetCount();
if( nbitems )
{
......@@ -455,12 +464,18 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
/* Create component list */
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
* files*/
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
for( DrawList = sheet->LastDrawList();
DrawList != NULL;
DrawList = DrawList->Next() )
{
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
sheet );
if( Component == NULL )
break;
......@@ -472,12 +487,13 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
NETLIST_OBJECT* Pin = s_SortedComponentPinList[ii];
if( !Pin )
continue;
wxString NetName = ReturnPinNetName( Pin, wxT( "N-%.6d" ) );
wxString NetName = ReturnPinNetName( Pin, wxT( "N-%.6d" ) );
if( NetName.IsEmpty() )
NetName = wxT( "?" );
if( use_netnames )
fprintf( f, " %s", CONV_TO_UTF8( NetName ) );
else // Use number for net names (with net number = 0 for "GND"
else // Use number for net names (with net number = 0 for
// "GND"
{
// NetName = "0" is "GND" net for Spice
if( NetName == wxT( "0" ) || NetName == wxT( "GND" ) )
......@@ -487,7 +503,8 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
}
}
fprintf( f, " %s\n", CONV_TO_UTF8( Component->GetField( VALUE )->m_Text ) );
fprintf( f, " %s\n",
CONV_TO_UTF8( Component->GetField( VALUE )->m_Text ) );
}
}
......@@ -512,16 +529,15 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
}
/*****************************************************************************************/
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with_pcbnew )
/*****************************************************************************************/
/* Routine de generation du fichier netliste ( Format ORCAD PCB 2 ameliore )
* si with_pcbnew = TRUE
* format PCBNEW (OrcadPcb2 + commentaires et liste des nets)
* si with_pcbnew = FALSE
* Format ORCADPCB2 strict
/* Generate net list file (Format 2 improves ORCAD PCB)
* = TRUE if with_pcbnew
* Format Pcbnew (OrcadPcb2 + reviews and lists of net)
* = FALSE if with_pcbnew
* Format ORCADPCB2 strict
*/
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
FILE* f,
bool with_pcbnew )
{
wxString Line, FootprintName;
char Buf[256];
......@@ -539,40 +555,51 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/* Create netlist module section */
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
*files*/
EDA_SheetList SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
for( DrawList = sheet->LastDrawList();
DrawList != NULL;
DrawList = DrawList->Next() )
{
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
sheet );
if( Component == NULL )
break;
/* Get the Component FootprintFilter and put the component in CmpList if filter is not void */
/* Get the Component FootprintFilter and put the component in
*CmpList if filter is not void */
LIB_COMPONENT* Entry =
CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list
**/
{
if( CmpList == NULL )
{
CmpList = (OBJ_CMP_TO_LIST*)
MyZMalloc( sizeof(OBJ_CMP_TO_LIST) * CmpListSize );
MyZMalloc( sizeof(OBJ_CMP_TO_LIST) *
CmpListSize );
}
if( CmpListCount >= CmpListSize )
{
CmpListSize += 1000;
CmpList = (OBJ_CMP_TO_LIST*) realloc(
CmpList,
sizeof(OBJ_CMP_TO_LIST) * CmpListSize );
CmpList =
(OBJ_CMP_TO_LIST*) realloc( CmpList,
sizeof(OBJ_CMP_TO_LIST)
* CmpListSize );
}
CmpList[CmpListCount].m_RootCmp = Component;
strcpy( CmpList[CmpListCount].m_Reference, Component->GetRef( sheet ).mb_str() );
strcpy( CmpList[CmpListCount].m_Reference,
Component->GetRef( sheet ).mb_str() );
CmpListCount++;
}
}
......@@ -587,8 +614,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
Line = Component->GetRef( sheet );
fprintf( f, " ( %s %s",
CONV_TO_UTF8( Component->GetPath( sheet ) ),
CONV_TO_UTF8( FootprintName ) );
CONV_TO_UTF8( Component->GetPath( sheet ) ),
CONV_TO_UTF8( FootprintName ) );
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
Line = Component->GetField( VALUE )->m_Text;
......@@ -615,7 +642,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
netname.Replace( wxT( " " ), wxT( "_" ) );
fprintf( f, " ( %4.4s %s )\n", (char*) &Pin->m_PinNum,
CONV_TO_UTF8( netname ) );
CONV_TO_UTF8( netname ) );
}
fprintf( f, " )\n" );
......@@ -638,7 +665,10 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Replace( wxT( " " ), wxT( "_" ) );
for( unsigned nn = 0; nn<sizeof(CmpList[ii].m_Reference) && CmpList[ii].m_Reference[nn]; nn++ )
for( unsigned nn = 0;
nn<sizeof(CmpList[ii].m_Reference)
&& CmpList[ii].m_Reference[nn];
nn++ )
{
if( CmpList[ii].m_Reference[nn] == ' ' )
CmpList[ii].m_Reference[nn] = '_';
......@@ -669,15 +699,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
}
/*************************************************************************************/
/*
* Add a new pin description in the pin list s_SortedComponentPinList
* a pin description is a pointer to the corresponding structure
* created by BuildNetList() in the table g_NetObjectslist
*/
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheetlist, LIB_PIN* Pin )
/*************************************************************************************/
/* Add a new pin description in the pin list s_SortedComponentPinList
* a pin description is a pointer to the corresponding structure
* created by BuildNetList() in the table g_NetObjectslist
*/
{
/* Search the PIN description for Pin in g_NetObjectslist*/
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
......@@ -691,63 +719,70 @@ static void AddPinToComponentPinList( SCH_COMPONENT* Component,
if( g_NetObjectslist[ii]->m_PinNum != Pin->m_PinNum )
continue;
s_SortedComponentPinList.push_back(g_NetObjectslist[ii]);
s_SortedComponentPinList.push_back( g_NetObjectslist[ii] );
if( s_SortedComponentPinList.size() >= MAXPIN )
{
/* Log message for Internal error */
DisplayError( NULL, wxT( "AddPinToComponentPinList err: MAXPIN reached" ) );
DisplayError( NULL,
wxT( "AddPinToComponentPinList err: MAXPIN reached" ) );
return;
}
}
}
/**********************************************************************/
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
/**********************************************************************/
/** Function EraseDuplicatePins
* Function to remove duplicate Pins in the TabPin pin list
* (This is a list of pins found in the whole schematic, for a given component)
* (This is a list of pins found in the whole schematic, for a given
* component)
* These duplicate pins were put in list because some pins (powers... )
* are found more than one time when we have a multiple parts per package component
* for instance, a 74ls00 has 4 parts, and therefore the VCC pin and GND pin appears 4 times
* are found more than one time when we have a multiple parts per package
* component
* for instance, a 74ls00 has 4 parts, and therefore the VCC pin and GND pin
* appears 4 times
* in the list.
* @param aPinList = a NETLIST_OBJECT_LIST that contains the list of pins for a given component.
* @param aPinList = a NETLIST_OBJECT_LIST that contains the list of pins for a
* given component.
* Note: this list *MUST* be sorted by pin number (.m_PinNum member value)
*/
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
{
if ( aPinList.size() == 0 ) // Trivial case: compnent with no pin
if( aPinList.size() == 0 ) // Trivial case: component with no pin
return;
for( unsigned ii = 0; ii < aPinList.size(); ii++ )
{
if( aPinList[ii] == NULL ) /* already deleted */
continue;
/* Search for duplicated pins
* If found, remove duplicates. The priority is to keep connected pins and remove unconnected
* If found, remove duplicates. The priority is to keep connected pins
* and remove unconnected
* - So this allows (for instance when using multi op amps per package
* - to connect only one op amp to power
* Because the pin list is sorted by m_PinNum value, duplicated pins are necessary successive in list
*/
* Because the pin list is sorted by m_PinNum value, duplicated pins
* are necessary successive in list
*/
int idxref = ii;
for( unsigned jj = ii + 1; jj < aPinList.size(); jj++ )
{
if ( aPinList[jj] == NULL ) // Already removed
if( aPinList[jj] == NULL ) // Already removed
continue;
if( aPinList[idxref]->m_PinNum != aPinList[jj]->m_PinNum ) // other pin num => end of duplicate list
// other pin num end of duplicate list.
if( aPinList[idxref]->m_PinNum != aPinList[jj]->m_PinNum )
break;
if ( aPinList[idxref]->m_FlagOfConnection == PAD_CONNECT )
if( aPinList[idxref]->m_FlagOfConnection == PAD_CONNECT )
aPinList[jj] = NULL;
else
{ /* the reference pin is not connected: remove this pin if the other pin is connected */
if ( aPinList[jj]->m_FlagOfConnection == PAD_CONNECT )
else /* the reference pin is not connected: remove this pin if the
* other pin is connected */
{
if( aPinList[jj]->m_FlagOfConnection == PAD_CONNECT )
{
aPinList[idxref] = NULL;
idxref = jj;
}
else // the 2 pins are not connected: remove the tested pin, and continue ...
else // the 2 pins are not connected: remove the tested pin,
// and continue ...
aPinList[jj] = NULL;
}
}
......@@ -798,12 +833,12 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
if( pin->m_Unit
&& ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) )
&& ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) )
continue;
if( pin->m_Convert
&& ( pin->m_Convert != Component2->m_Convert ) )
continue;
&& ( pin->m_Convert != Component2->m_Convert ) )
continue;
// A suitable pin in found: add it to the current list
AddPinToComponentPinList( Component2, sheet, pin );
......@@ -814,16 +849,15 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
/*
Routine de comparaison pour le tri des pins par numero croissant
* du tableau des pins s_SortedComponentPinList par qsort()
* Comparison routine for sorting by pin numbers.
*/
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 )
{
int Num1, Num2;
char Line[5];
Num1 = Pin1->m_PinNum;
Num2 = Pin2->m_PinNum;
Num1 = Pin1->m_PinNum;
Num2 = Pin2->m_PinNum;
Line[4] = 0;
memcpy( Line, &Num1, 4 ); Num1 = atoi( Line );
memcpy( Line, &Num2, 4 ); Num2 = atoi( Line );
......@@ -831,13 +865,10 @@ static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 )
}
/*************************************************************************/
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
/*************************************************************************/
/* Ecrit dans le fichier f la liste des nets ( classee par NetCodes ), et des
* elements qui y sont connectes
/* Written in the file / net list (ranked by Netcode), and elements that are
* connected
*/
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
{
int NetCode, LastNetCode = -1;
int SameNetcodeCount = 0;
......@@ -848,12 +879,15 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
for( unsigned ii = 0; ii < aObjectsList.size(); ii++ )
{
if( ( NetCode = aObjectsList[ii]->GetNet() ) != LastNetCode ) // New net found, write net id;
// New net found, write net id;
if( ( NetCode = aObjectsList[ii]->GetNet() ) != LastNetCode )
{
SameNetcodeCount = 0; // Items count for this net
SameNetcodeCount = 0; // Items count for this net
NetName.Empty();
unsigned jj;
for( jj = 0; jj < aObjectsList.size(); jj++ ) // Find a label (if exists) for this net
// Find a label (if exists) for this net.
for( jj = 0; jj < aObjectsList.size(); jj++ )
{
if( aObjectsList[jj]->GetNet() != NetCode )
continue;
......@@ -873,13 +907,15 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
{
// usual net name, prefix it by the sheet path
NetcodeName += aObjectsList[jj]->m_SheetList.PathHumanReadable();
NetcodeName +=
aObjectsList[jj]->m_SheetList.PathHumanReadable();
}
NetcodeName += NetName;
}
NetcodeName += wxT( "\"" );
// Add the netname without prefix, in cases we need only the "short" netname
// Add the netname without prefix, in cases we need only the
// "short" netname
NetcodeName += wxT( " \"" ) + NetName + wxT( "\"" );
LastNetCode = NetCode;
}
......@@ -887,20 +923,26 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
if( aObjectsList[ii]->m_Type != NET_PIN )
continue;
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
CmpRef = Cmp->GetRef( &aObjectsList[ii]->m_SheetList ); // Get the reference for thenetname and the main parent component
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
// Get the reference for the net name and the main parent component
CmpRef = Cmp->GetRef( &aObjectsList[ii]->m_SheetList );
if( CmpRef.StartsWith( wxT( "#" ) ) )
continue; // Pseudo component (Like Power symbol)
continue; // Pseudo component (Like Power symbol)
// Print the pin list for this net, if 2 or more items are connected:
SameNetcodeCount++;
if( SameNetcodeCount == 1 ) /* first item for this net found,
* Print this connection, when a second item will be found */
* Print this connection, when a
* second item will be found */
{
sprintf( FirstItemInNet, " %s %.4s\n", CONV_TO_UTF8( CmpRef ),
(const char*) &aObjectsList[ii]->m_PinNum );
}
if( SameNetcodeCount == 2 ) // Second item for this net found, Print the Net name, and the first item
// Second item for this net found, Print the Net name, and the
// first item
if( SameNetcodeCount == 2 )
{
fprintf( f, "%s\n", CONV_TO_UTF8( NetcodeName ) );
fputs( FirstItemInNet, f );
......@@ -913,39 +955,37 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
}
/* Generation des netlistes au format CadStar */
/* Generate CADSTAR net list. */
wxString StartLine( wxT( "." ) );
/*********************************************************/
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
/*********************************************************/
/* Routine de generation du fichier netliste ( Format CADSTAR )
* Entete:
* ..HEA
* ..TIM 2004 07 29 16 22 17
* ..APP "Cadstar RINF Output - Version 6.0.2.3"
* ..UNI INCH 1000.0 in
* ..TYP FULL
/* Routine generation of the netlist file (CADSTAR Format)
* Header:
* HEA ..
* TIM .. 2004 07 29 16 22 17
* APA .. "Cadstar RINF Output - Version 6.0.2.3"
* INCH UNI .. 1000.0 in
* FULL TYP ..
*
* liste des composants:
* ..ADD_COM X1 "CNT D41612 (48PTS MC CONTOUR)"
* ..ADD_COM U2 "74HCT245D" "74HCT245D"
* List of components:
* .. ADD_COM X1 "CNT D41612 (48pts CONTOUR TM)"
* .. ADD_COM U2 "74HCT245D" "74HCT245D"
*
* Connexions:
* ..ADD_TER RR2 6 "$42"
* ..TER U1 100
* CA 6
* Connections:
* .. ADD_TER RR2 * 6 "$ 42"
* .. B U1 100
* 6 CA
*
* ..ADD_TER U2 6 "$59"
* ..TER U7 39
* U6 17
* U1 122
* ADD_TER .. U2 * 6 "$ 59"
* .. B * U7 39
* U6 17
* U1 * 122
*
* ..ADD_TER P2 1 "$9"
* ..TER T3 1
* U1 14
* .. ADD_TER P2 * 1 "$ 9"
* .. B * T3 1
*U1 * 14
*/
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
{
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
wxString msg;
......@@ -964,14 +1004,20 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
fprintf( f, "\n" );
/* Create netlist module section */
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
*files*/
EDA_SheetList SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
for( DrawList = sheet->LastDrawList();
DrawList != NULL;
DrawList = DrawList->Next() )
{
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
sheet );
if( Component == NULL )
break;
......@@ -1004,17 +1050,15 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
}
/*************************************************************************/
static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
/*************************************************************************/
/* Ecrit dans le fichier f la liste des nets ( classee par NetCodes ), et des
* pins qui y sont connectes
* format:
* .ADD_TER RR2 6 "$42"
* .TER U1 100
* CA 6
/*
* Written in the file / net list (ranked by Netcode), and
* Pins connected to it
* Format:
*. ADD_TER RR2 6 "$ 42"
*. B U1 100
* 6 CA
*/
static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
{
wxString InitNetDesc = StartLine + wxT( "ADD_TER" );
wxString StartNetDesc = StartLine + wxT( "TER" );
......@@ -1052,11 +1096,12 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
NetcodeName += NetName;
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
{
NetcodeName = aObjectsList[jj]->m_SheetList.PathHumanReadable()
+ NetcodeName;
NetcodeName =
aObjectsList[jj]->m_SheetList.PathHumanReadable()
+ NetcodeName;
//NetcodeName << wxT("_") <<
// g_NetObjectslist[jj].m_SheetList.PathHumanReadable();
// g_NetObjectslist[jj].m_SheetList.PathHumanReadable();
}
}
else // this net has no name: create a default name $<net number>
......@@ -1076,7 +1121,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
wxString refstr = Cmp->GetRef( &(aObjectsList[ii]->m_SheetList) );
if( refstr[0] == '#' )
continue; // Pseudo composant (symboles d'alims)
continue; // Power supply symbols.
switch( print_ter )
{
......@@ -1085,12 +1130,13 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
char buf[5];
wxString str_pinnum;
strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 );
buf[4] = 0;
buf[4] = 0;
str_pinnum = CONV_FROM_UTF8( buf );
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
InitNetDesc.GetData(),
refstr.GetData(),
str_pinnum.GetData(), NetcodeName.GetData() );
InitNetDesc.GetData(),
refstr.GetData(),
str_pinnum.GetData(),
NetcodeName.GetData() );
}
print_ter++;
break;
......@@ -1113,8 +1159,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
aObjectsList[ii]->m_Flag = 1;
// Recherche des pins redondantes et mise a 1 de m_Flag,
// pour ne pas generer plusieurs fois la connexion
// Search for redundant pins to avoid generation the same connection
// more than once.
for( jj = ii + 1; jj < aObjectsList.size(); jj++ )
{
if( aObjectsList[jj]->GetNet() != NetCode )
......
/***********************************/
/* Module de calcul de la Netliste */
/***********************************/
/*****************/
/* netlist.cpp */
/*****************/
#include "fctsys.h"
#include "common.h"
#include "program.h"
#include "general.h"
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "netlist.h"
#include "protos.h"
#include "class_library.h"
......@@ -19,7 +19,6 @@ NETLIST_OBJECT_LIST g_NetObjectslist;
//#define NETLIST_DEBUG
/* Routines locales */
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
static void ListeObjetConnection( DrawSheetPath* sheetlist,
......@@ -35,34 +34,33 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer );
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
// Sort functions used here:
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
const NETLIST_OBJECT* Objet2 );
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
const NETLIST_OBJECT* Objet2 );
/* Variable locales */
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
static int LastNetCode, LastBusNetCode;
#if defined(DEBUG)
void dumpNetTable()
{
for( unsigned idx = 0; idx < g_NetObjectslist.size(); ++idx )
for( unsigned idx = 0; idx < g_NetObjectslist.size(); ++idx )
{
g_NetObjectslist[idx]->Show( std::cout, idx );
}
}
#endif
/*********************************************************************/
void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
/*********************************************************************/
/*
* Routine de liberation memoire des tableaux utilises pour le calcul
* de la netliste
* TabNetItems = pointeur sur le tableau principal (liste des items )
* Routine to free memory used to calculate the netlist TabNetItems = pointer
* to the main table (list items)
*/
void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
{
for( unsigned i = 0; i < aNetObjectsBuffer.size(); i++ )
delete aNetObjectsBuffer[i];
......@@ -71,15 +69,13 @@ void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
}
/************************************************************************/
void WinEDA_SchematicFrame::BuildNetListBase()
/************************************************************************/
/* Routine qui construit le tableau des elements connectes du projet
* met a jour:
* g_NetObjectslist
* g_NetObjectslist
/*
* Build net list connection table.
*
* Updates:
* g_NetObjectslist
*/
void WinEDA_SchematicFrame::BuildNetListBase()
{
int NetNumber;
int NetCode;
......@@ -104,10 +100,11 @@ void WinEDA_SchematicFrame::BuildNetListBase()
ListeObjetConnection( sheet, g_NetObjectslist );
if( g_NetObjectslist.size() == 0 )
return; // no objects
return; // no objects
activity.Empty();
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) << g_NetObjectslist.size();
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) <<
g_NetObjectslist.size();
SetStatusText( activity );
/* Sort objects by Sheet */
......@@ -125,24 +122,25 @@ void WinEDA_SchematicFrame::BuildNetListBase()
NETLIST_OBJECT* net_item = g_NetObjectslist[ii];
if( net_item->m_SheetList != *sheet ) // Sheet change
{
sheet = &(net_item->m_SheetList);
sheet = &(net_item->m_SheetList);
istart = ii;
}
switch( net_item->m_Type )
{
case NET_ITEM_UNSPECIFIED:
wxMessageBox(wxT("BuildNetListBase() error"));
wxMessageBox( wxT( "BuildNetListBase() error" ) );
break;
case NET_PIN:
case NET_PINLABEL:
case NET_SHEETLABEL:
case NET_NOCONNECT:
if( net_item->GetNet() != 0 )
break; /* Deja connecte */
break;
case NET_SEGMENT:
/* Controle des connexions type point a point ( Sans BUS ) */
/* Control connections point to point type without bus. */
if( net_item->GetNet() == 0 )
{
net_item->SetNet( LastNetCode );
......@@ -152,7 +150,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
break;
case NET_JONCTION:
/* Controle des jonction , hors BUS */
/* Control of the junction outside BUS. */
if( net_item->GetNet() == 0 )
{
net_item->SetNet( LastNetCode );
......@@ -160,7 +158,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
}
SegmentToPointConnect( net_item, 0, istart );
/* Controle des jonction , sur BUS */
/* Control of the junction, on BUS. */
if( net_item->m_BusNetCode == 0 )
{
net_item->m_BusNetCode = LastBusNetCode;
......@@ -172,7 +170,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL:
/* Controle des connexions type jonction ( Sans BUS ) */
/* Control connections type junction without bus. */
if( net_item->GetNet() == 0 )
{
net_item->SetNet( LastNetCode );
......@@ -183,10 +181,10 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case NET_SHEETBUSLABELMEMBER:
if( net_item->m_BusNetCode != 0 )
break; /* Deja connecte */
break;
case NET_BUS:
/* Controle des connexions type point a point mode BUS */
/* Control type connections point to point mode bus */
if( net_item->m_BusNetCode == 0 )
{
net_item->m_BusNetCode = LastBusNetCode;
......@@ -198,7 +196,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case NET_BUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
/* Controle des connexions semblables a des sur BUS */
/* Control connections similar has on BUS */
if( net_item->GetNet() == 0 )
{
net_item->m_BusNetCode = LastBusNetCode;
......@@ -218,14 +216,14 @@ void WinEDA_SchematicFrame::BuildNetListBase()
activity << wxT( " " ) << _( "Done" );
SetStatusText( activity );
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
/* Updating the Bus Labels Netcode connected by Bus */
ConnectBusLabels( g_NetObjectslist );
activity << wxT( "; " ) << _( "Labels" );
SetStatusText( activity );
/* Connections des groupes d'objets par labels identiques */
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
/* Group objects by label. */
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
{
switch( g_NetObjectslist[ii]->m_Type )
{
......@@ -249,6 +247,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
break;
case NET_ITEM_UNSPECIFIED:
break;
}
......@@ -262,7 +261,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
activity << wxT( " " ) << _( "Done" );
SetStatusText( activity );
/* Connexion des hierarchies */
/* Connection hierarchy. */
activity << wxT( "; " ) << _( "Hierar." );
SetStatusText( activity );
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
......@@ -283,7 +282,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
activity << wxT( " " ) << _( "Done" );
SetStatusText( activity );
/* Compression des numeros de NetCode a des valeurs consecutives */
/* Compress numbers of Netcode having consecutive values. */
LastNetCode = NetCode = 0;
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
{
......@@ -295,42 +294,42 @@ void WinEDA_SchematicFrame::BuildNetListBase()
g_NetObjectslist[ii]->SetNet( NetCode );
}
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
/* Assignment of m_FlagOfConnection based connection or not. */
SetUnconnectedFlag( g_NetObjectslist );
}
/*************************************************************
* Routine qui connecte les sous feuilles par les sheetLabels *
**************************************************************/
/*
* Connect sheets by sheetLabels
*/
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
{
if( SheetLabel->GetNet() == 0 )
return;
/* Calcul du numero de sous feuille correspondante au sheetlabel */
/* Calculate the number of nodes in the corresponding sheetlabel */
/* Comparison with SheetLabel GLABELS sub sheet to group Netcode */
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
* pour regroupement des NetCodes */
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
{
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
continue; //use SheetInclude, not the sheet!!
continue; //use SheetInclude, not the sheet!!
if( (ObjetNet->m_Type != NET_HIERLABEL )
&& (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
continue;
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
continue; //already connected.
continue; //already connected.
wxASSERT(ObjetNet->m_Label);
wxASSERT(SheetLabel->m_Label);
wxASSERT( ObjetNet->m_Label );
wxASSERT( SheetLabel->m_Label );
if( ObjetNet->m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
continue; //different names.
continue; //different names.
/* Propagation du Netcode a tous les Objets de meme NetCode */
/* Propagate Netcode having all the objects of the same Netcode. */
if( ObjetNet->GetNet() )
PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 );
else
......@@ -339,35 +338,36 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
}
/**************************************************************************************/
static void ListeObjetConnection( DrawSheetPath* sheetlist,
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
/**************************************************************************************/
/** Function ListeObjetConnection
* Creates the list of objects related to connections (pins of components, wires, labels, junctions ...)
* Creates the list of objects related to connections (pins of components,
* wires, labels, junctions ...)
*
* @param sheetlist: pointer to a sheetlist.
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT created
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT
* created
*/
static void ListeObjetConnection( DrawSheetPath* sheetlist,
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
{
int ii;
SCH_ITEM* DrawList;
NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry;
LIB_PIN* pin;
Hierarchical_PIN_Sheet_Struct* SheetLabel;
DrawSheetPath list;
int ii;
SCH_ITEM* DrawList;
NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry;
LIB_PIN* pin;
SCH_SHEET_PIN* SheetLabel;
DrawSheetPath list;
DrawList = sheetlist->LastScreen()->EEDrawList;
for( ; DrawList; DrawList = DrawList->Next() )
for( ; DrawList; DrawList = DrawList->Next() )
{
switch( DrawList->Type() )
{
case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) )
if( (STRUCT->GetLayer() != LAYER_BUS)
&& (STRUCT->GetLayer() != LAYER_WIRE) )
break;
new_item = new NETLIST_OBJECT();
......@@ -381,7 +381,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
{
new_item->m_Type = NET_BUS;
}
else /* Cas des WIRE */
else /* WIRE */
{
new_item->m_Type = NET_SEGMENT;
}
......@@ -436,7 +436,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
aNetItemBuffer.push_back( new_item );
/* Si c'est un Bus, eclatement en Label */
/* If a bus connects to label */
if( ii )
ConvertBusToMembers( aNetItemBuffer, *new_item );
......@@ -454,8 +454,10 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
new_item->m_Comp = STRUCT;
new_item->m_Type = NET_LABEL;
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it
new_item->m_Type = NET_GLOBLABEL; // (look at the case statement above).
// this is not the simplest way of doing it
// (look at the case statement above).
if( STRUCT->m_Layer == LAYER_GLOBLABEL )
new_item->m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL )
new_item->m_Type = NET_HIERLABEL;
......@@ -463,7 +465,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
aNetItemBuffer.push_back( new_item );
/* Si c'est un Bus, eclatement en Label */
/* If a bus connects to label */
if( ii )
ConvertBusToMembers( aNetItemBuffer, *new_item );
......@@ -480,16 +482,17 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
break;
for( pin = Entry->GetNextPin(); pin != NULL;
pin = Entry->GetNextPin( pin ) )
pin = Entry->GetNextPin( pin ) )
{
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
if( pin->m_Unit
&& ( pin->m_Unit != DrawLibItem->GetUnitSelection( sheetlist ) ) )
&& ( pin->m_Unit !=
DrawLibItem->GetUnitSelection( sheetlist ) ) )
continue;
if( pin->m_Convert
&& ( pin->m_Convert != DrawLibItem->m_Convert ) )
&& ( pin->m_Convert != DrawLibItem->m_Convert ) )
continue;
wxPoint pos2 =
......@@ -512,7 +515,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
if( ( (int) pin->m_PinType == (int) PIN_POWER_IN )
&& ( pin->m_Attributs & PINNOTDRAW ) )
{
/* Il y a un PIN_LABEL Associe */
/* There is an associated PIN_LABEL. */
new_item = new NETLIST_OBJECT();
new_item->m_SheetListInclude = *sheetlist;
new_item->m_Comp = NULL;
......@@ -536,7 +539,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList )
#define STRUCT ( (SCH_SHEET*) DrawList )
list = *sheetlist;
list.Push( STRUCT );
SheetLabel = STRUCT->m_Label;
......@@ -555,7 +558,6 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
new_item->m_Start = new_item->m_End = SheetLabel->m_Pos;
aNetItemBuffer.push_back( new_item );
/* Si c'est un Bus, eclatement en Label */
if( ii )
ConvertBusToMembers( aNetItemBuffer, *new_item );
}
......@@ -576,16 +578,14 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
}
/************************************************************************/
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
/************************************************************************/
/* Routine qui analyse les labels type xxBUSLABELMEMBER
* Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
* leur numero de membre est identique) lorsqu'ils sont connectes
* globalement par leur BusNetCode
* Utilise et met a jour la variable LastNetCode
/*
* Routine that analyzes the type labels xxBUSLABELMEMBER
* Propagate Netcode between the corresponding labels (ie when
* Their member number is the same) when they are connected
* Generally by their BusNetCode
* Uses and updates the variable LastNetCode
*/
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
{
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
{
......@@ -600,7 +600,7 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
LastNetCode++;
}
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
{
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
......@@ -616,7 +616,8 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
if( LabelInTst->GetNet() == 0 )
LabelInTst->SetNet( Label->GetNet() );
else
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 );
PropageNetCode( LabelInTst->GetNet(),
Label->GetNet(), 0 );
}
}
}
......@@ -624,16 +625,12 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
}
/**************************************************/
int IsBusLabel( const wxString& LabelDrawList )
/**************************************************/
/* Routine qui verifie si le Label a une notation de type Bus
* Retourne 0 si non
* nombre de membres si oui
* met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
/* Check if the Label has a bus notation.
* Returns 0 if not
* Number of members if yes
* Updates FirstNumWireBus, LastNumWireBus and RootBusNameLength
*/
int IsBusLabel( const wxString& LabelDrawList )
{
unsigned Num;
int ii;
......@@ -672,7 +669,7 @@ int IsBusLabel( const wxString& LabelDrawList )
}
if( !BufLine.ToLong( &tmp ) )
error = TRUE;;
error = TRUE; ;
LastNumWireBus = tmp;
if( FirstNumWireBus < 0 )
......@@ -688,21 +685,20 @@ int IsBusLabel( const wxString& LabelDrawList )
}
/***************************************************************/
/*
* Routine which breaks a seal Bus type Label in as many members it contains,
* And creates structures with type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
* Or NET_SHEETBUSLABELMEMBER
* Entry = pointer to NETLIST_OBJECT initializes the corresp buslabel
* Assumes that FirstNumWireBus, LastNumWireBus and RootBusNameLength are up
* to date
* Amends NETLIST_OBJECT base and meets the following
* M_Label is a pointer to a new wxString
* M_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
* NET_BUSLABELMEMBER gold NET_SHEETBUSLABELMEMBER object type)
*/
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
NETLIST_OBJECT& BusLabel )
/***************************************************************/
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
* et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
* ou NET_SHEETBUSLABELMEMBER
* entree = pointeur sur l'NETLIST_OBJECT initialise corresp au buslabel
* suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
* modifie l'NETLIST_OBJECT de base et remplit les suivants
* m_Label is a pointer to a new wxString
* m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
* NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
*/
{
int NumItem, BusMember;
wxString BufLine;
......@@ -716,7 +712,7 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
else
BusLabel.m_Type = NET_BUSLABELMEMBER;
/* Convertion du BusLabel en la racine du Label + le numero du fil */
/* Conversion of BusLabel in the root of the Label + the number of wire. */
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
BusMember = FirstNumWireBus;
......@@ -730,7 +726,9 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
{
NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel );
NumItem++;
/* Convertion du BusLabel en la racine du Label + le numero du fil */
/* Conversion of BusLabel in the root of the Label + the number
* of wire */
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
BufLine << BusMember;
new_label->m_Label = new wxString( BufLine );
......@@ -743,21 +741,18 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
}
/**********************************************************************/
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
/**********************************************************************/
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
* appartenant a l'ancien netcode OldNetCode
* Si IsBus == 0; c'est le membre NetCode qui est propage
* Si IsBus != 0; c'est le membre BusNetCode qui est propage
/*
* PropageNetCode propagates Netcode NewNetCode on all elements
* belonging to the former Netcode OldNetCode
* If IsBus == 0; Netcode is the member who is spreading
* If IsBus! = 0; is the member who is spreading BusNetCode
*/
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
{
if( OldNetCode == NewNetCode )
return;
if( IsBus == 0 ) /* Propagation du NetCode */
if( IsBus == 0 ) /* Propagate NetCode */
{
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
{
......@@ -768,7 +763,7 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
}
}
}
else /* Propagation du BusNetCode */
else /* Propagate BusNetCode */
{
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
{
......@@ -782,32 +777,30 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
}
/***************************************************************************/
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
/***************************************************************************/
/* Routine qui verifie si l'element *Ref est connecte a
* d'autres elements de la liste des objets du schema, selon le mode Point
* a point ( Extremites superposees )
/*
* Check if Ref element is connected to other elements of the list of objects
* in the schematic, by mode point
* A point (end superimposed)
*
* si IsBus:
* la connexion ne met en jeu que des elements type bus
* ( BUS ou BUSLABEL ou JONCTION )
* sinon
* la connexion ne met en jeu que des elements type non bus
* ( autres que BUS ou BUSLABEL )
* If IsBus:
* The connection involves elements such as bus
* (Or BUS or BUSLABEL JUNCTION)
* Otherwise
* The connection involves elements such as non-bus
* (Other than BUS or BUSLABEL)
*
* L'objet Ref doit avoir un NetCode valide.
* The Ref object must have a valid Netcode.
*
* La liste des objets est supposee classe par SheetPath Croissants,
* et la recherche se fait a partir de l'element start, 1er element
* de la feuille de schema
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
* The list of objects is SUPPOSED class by SheetPath Croissants,
* And research is done from the start element, 1st element
* Leaf schema
* (There can be no physical connection between elements of different sheets)
*/
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
{
int netCode;
if( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
if( IsBus == 0 ) /* Objects other than BUS and BUSLABELS. */
{
netCode = Ref->GetNet();
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
......@@ -849,10 +842,10 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
}
}
}
else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
else /* Object type BUS, BUSLABELS, and junctions. */
{
netCode = Ref->m_BusNetCode;
for( unsigned i = start; i<g_NetObjectslist.size(); i++ )
for( unsigned i = start; i<g_NetObjectslist.size(); i++ )
{
NETLIST_OBJECT* item = g_NetObjectslist[i];
if( item->m_SheetList != Ref->m_SheetList )
......@@ -894,20 +887,18 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
}
/**************************************************************/
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
int IsBus, int start )
/***************************************************************/
/*
* Routine qui recherche si un point (jonction) est connecte a des segments,
* et regroupe les NetCodes des objets connectes a la jonction.
* Le point de jonction doit avoir un netcode valide
* La liste des objets est supposee classe par NumSheet Croissants,
* et la recherche se fait a partir de l'element start, 1er element
* de la feuille de schema
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
* Search if a junction is connected to segments and include the Netcode
* objects connect to the junction.
* The junction must have a valid Netcode
* The list of objects is SUPPOSED class by NumSheet *JP translate*
* Croissants,
* And research is done from the start element, 1st element
* Leaf schema
* (There can be no physical connection between elements of different sheets)
*/
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
int IsBus, int start )
{
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
{
......@@ -931,7 +922,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
Segment->m_End.x, Segment->m_End.y,
Jonction->m_Start.x, Jonction->m_Start.y ) )
{
/* Propagation du Netcode a tous les Objets de meme NetCode */
/* Propagation Netcode has all the objects of the same Netcode. */
if( IsBus == 0 )
{
if( Segment->GetNet() )
......@@ -961,7 +952,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
if( LabelRef->GetNet() == 0 )
return;
for( unsigned i = 0; i < g_NetObjectslist.size(); i++ )
for( unsigned i = 0; i < g_NetObjectslist.size(); i++ )
{
if( g_NetObjectslist[i]->GetNet() == LabelRef->GetNet() )
continue;
......@@ -991,12 +982,13 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|| ntype == NET_HIERBUSLABELMEMBER
|| ntype == NET_PINLABEL )
{
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label )
!= 0 )
continue;
// Propagation du Netcode a tous les Objets de meme NetCode
if( g_NetObjectslist[i]->GetNet() )
PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
PropageNetCode(
g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
else
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
}
......@@ -1004,37 +996,31 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
}
/****************************************************************************/
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
/****************************************************************************/
/* Routine de comparaison pour le tri par NetCode croissant
* du tableau des elements connectes ( TabPinSort ) par qsort()
/* Comparison routine for sorting by increasing Netcode
* table of elements connected (TabPinSort) by qsort ()
*/
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
const NETLIST_OBJECT* Objet2 )
{
return Objet1->GetNet() < Objet2->GetNet();
}
/*****************************************************************************************/
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
/*****************************************************************************************/
/* Routine de comparaison pour le tri par NumSheet
* du tableau des elements connectes ( TabPinSort ) par qsort() */
/* Comparison routine for sorting by NumSheet table of elements
* connected (TabPinSort) by qsort ()
*/
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
const NETLIST_OBJECT* Objet2 )
{
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
}
/**********************************************************************/
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
/**********************************************************************/
/* Routine positionnant le membre .FlagNoConnect des elements de
* la liste des objets netliste, tries par ordre de NetCode
/* Routine positioning member. FlagNoConnect ELEMENTS
* List of objects NetList, sorted by order of Netcode
*/
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
{
NETLIST_OBJECT* NetItemRef;
unsigned NetStart, NetEnd;
......@@ -1048,16 +1034,17 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
StateFlag = NOCONNECT_SYMBOL_PRESENT;
/* Analyse du net en cours */
/* Analysis of current net. */
unsigned idxtoTest = ii + 1;
if( ( idxtoTest >= aNetItemBuffer.size() )
|| ( NetItemRef->GetNet() != aNetItemBuffer[idxtoTest]->GetNet() ) )
{
/* Net analyse: mise a jour de m_FlagOfConnection */
/* Net analysis to update m_FlagOfConnection */
NetEnd = idxtoTest;
/* set m_FlagOfConnection member to StateFlag for all items of this net: */
/* set m_FlagOfConnection member to StateFlag for all items of
* this net: */
for( unsigned kk = NetStart; kk < NetEnd; kk++ )
aNetItemBuffer[kk]->m_FlagOfConnection = StateFlag;
......@@ -1070,11 +1057,13 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
continue;
}
/* test the current item: if this is a pin and if the reference item is also a pin,
* then 2 pins are connected, so set StateFlag to PAD_CONNECT (can be already done)
* Of course, if the current item is a no connect symbol, set StateFlag to NOCONNECT_SYMBOL_PRESENT
* to inhibit error diags. However if StateFlag is already set to PAD_CONNECT
* this state is kept (the no connect symbol was surely an error and an ERC will report this)
/* test the current item: if this is a pin and if the reference item
* is also a pin, then 2 pins are connected, so set StateFlag to
* PAD_CONNECT (can be already done) Of course, if the current
* item is a no connect symbol, set StateFlag to
* NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
* StateFlag is already set to PAD_CONNECT this state is kept (the
* no connect symbol was surely an error and an ERC will report this)
*/
for( ; ; idxtoTest++ )
{
......@@ -1085,8 +1074,9 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
switch( aNetItemBuffer[idxtoTest]->m_Type )
{
case NET_ITEM_UNSPECIFIED:
wxMessageBox(wxT("BuildNetListBase() error"));
wxMessageBox( wxT( "BuildNetListBase() error" ) );
break;
case NET_SEGMENT:
case NET_LABEL:
case NET_HIERLABEL:
......
/**********************************************/
/* Module de calcul de la Netliste: netlist.h */
/**********************************************/
/***************/
/* netlist.h */
/***************/
#ifndef _NETLIST_H_
#define _NETLIST_H_
......@@ -37,7 +37,6 @@ enum TypeNetForm {
#define MAXPIN 5000
/* object used in annotation to handle a list of components in schematic
* because in a complex hierarchy, a component is used more than once,
* and its reference is depending on the sheet path
......@@ -47,16 +46,23 @@ enum TypeNetForm {
class OBJ_CMP_TO_LIST
{
public:
SCH_COMPONENT* m_RootCmp; // the component in schematic
LIB_COMPONENT* m_Entry; // the source component in library
int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */
DrawSheetPath m_SheetPath; /* the sheet path for this component */
unsigned long m_TimeStamp; /* unique identification number depending on sheet path */
bool m_IsNew; /* true for not yet annotated components */
wxString* m_Value; /* Component value (same for all instances) */
char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */
int m_NumRef; /* Reference number (for IC1, this is 1) ) depending on sheet path*/
int m_Flag; /* flag for computations */
SCH_COMPONENT* m_RootCmp; // the component in schematic
LIB_COMPONENT* m_Entry; // the source component in library
int m_Unit; /* Selected part (For multi parts per
* package) depending on sheet path */
DrawSheetPath m_SheetPath; /* the sheet path for this component */
unsigned long m_TimeStamp; /* unique identification number
* depending on sheet path */
bool m_IsNew; /* true for not yet annotated
* components */
wxString* m_Value; /* Component value (same for all
* instances) */
char m_Reference[32]; /* Component reference prefix, without
* number (for IC1, this is IC) ) */
int m_NumRef; /* Reference number (for IC1, this is
* 1) ) depending on sheet path*/
int m_Flag; /* flag for computations */
public:
OBJ_CMP_TO_LIST()
......@@ -96,7 +102,7 @@ public:
// Buffer to build the list of items used in netlist and erc calculations
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
extern NETLIST_OBJECT_LIST g_NetObjectslist;
extern NETLIST_OBJECT_LIST g_NetObjectslist;
/* Prototypes: */
......@@ -110,7 +116,8 @@ void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
* @param first = true: return first name of the list, false = return next
* @return a wxString : name of the type netlist or empty string
* this function must be called first with "first_item" = true
* and after with "first_item" = false to get all the other existing netlist names
* and after with "first_item" = false to get all the other existing netlist
* names
*/
wxString ReturnUserNetlistTypeName( bool first_item );
......
......@@ -3,12 +3,12 @@
/**********************************/
/* Functions relatives to the dialog creating the netlist for pcbnew.
* The dialo is a notebook with 4 fixed netlist format:
* The dialog is a notebook with 4 fixed netlist format:
* PCBNEW ORCADPCB2 CADSTAR and SPICE
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
* calling an external converter with convert an intermediate format to the
* user specific format.
* these external converters are refered there as plugins,
* these external converters are referred there as plugins,
* but there are not really plugins, there are only external binaries
*/
......@@ -306,7 +306,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
/* Install the panel "Add Plugin" after
* the last initialised panel */
* the last initialized panel */
previoustitle = title;
if( title.IsEmpty() )
CurrPage =
......@@ -357,10 +357,10 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
Mask = wxT( "*" );
Path = wxGetApp().m_BinDir;
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
wxEmptyString, /* extension par defaut */
Mask, /* Masque d'affichage */
Path,
FullFileName,
wxEmptyString,
Mask,
this,
wxFD_OPEN,
TRUE
......@@ -379,7 +379,8 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() )
DisplayInfoMessage( this,
_( "Do not forget to choose a title for this netlist control page" ) );
_( "Do not forget to choose a title for this \
netlist control page" ) );
}
......@@ -436,7 +437,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
/** Function GenNetlist
* Create the netlist file:
* calcualte the filename with the suitable extentions
* calculate the filename with the suitable extensions
* and run the netlist creator
*/
{
......
/******************************************************/
/* schedit.cpp: fonctions generales de la schematique */
/******************************************************/
/*******************/
/* onleftclick.cpp */
/*******************/
#include "fctsys.h"
#include "common.h"
......@@ -17,22 +17,20 @@
static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList;
/**********************************************************************************/
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/**********************************************************************************/
/* Traite les commandes declench�e par le bouton gauche de la souris,
* quand un outil est deja selectionn�
/* Process the command triggers by the left button of the mouse when a tool
* is already selected.
*/
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
if( ( m_ID_current_state == 0 ) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
g_ItemToRepeat = NULL;
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
if( DrawStruct && DrawStruct->m_Flags )
{
switch( DrawStruct->Type() )
{
......@@ -48,22 +46,22 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_PART_TEXT_STRUCT_TYPE:
DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); // don't draw here
TestDanglingEnds( GetScreen()->EEDrawList, NULL );
DrawPanel->Refresh( TRUE );
return;
case SCREEN_STRUCT_TYPE:
DisplayError( this,
wxT( "OnLeftClick err: unexpected type for Place" ) );
wxT( "OnLeftClick err: unexpected type for Place" ) );
DrawStruct->m_Flags = 0;
break;
case DRAW_SEGMENT_STRUCT_TYPE: // Segment peut-etre en cours de trace
case DRAW_SEGMENT_STRUCT_TYPE: // May already be drawing segment.
break;
default:
DisplayError( this,
wxT( "WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0" ) );
wxT( "WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0" ) );
DrawStruct->m_Flags = 0;
break;
}
......@@ -86,16 +84,16 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && DrawStruct->m_Flags )
break;
DrawStruct = SchematicGeneralLocateAndDisplay();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
if( DrawStruct && ( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) )
{
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
InstallNextScreen( (SCH_SHEET*) DrawStruct );
}
else
InstallPreviousSheet();
break;
case ID_NOCONN_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
g_ItemToRepeat = CreateNewNoConnectStruct( DC );
GetScreen()->SetCurItem( g_ItemToRepeat );
......@@ -111,9 +109,11 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_JUNCTION_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
g_ItemToRepeat = CreateNewJunctionStruct( DC,
GetScreen()->m_Curseur,
TRUE );
GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
}
......@@ -128,7 +128,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_WIRETOBUS_ENTRY_BUTT:
case ID_BUSTOBUS_ENTRY_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
DrawStruct =
CreateBusEntry( DC,
......@@ -171,7 +171,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_TEXT_COMMENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE;
......@@ -184,7 +184,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_LABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
......@@ -232,7 +232,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_SHEET_SYMBOL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateSheet( DC ) );
DrawPanel->m_AutoPAN_Request = TRUE;
......@@ -248,7 +248,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_IMPORT_HLABEL_BUTT:
case ID_SHEET_LABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
DrawStruct = SchematicGeneralLocateAndDisplay();
if( DrawStruct == NULL )
......@@ -259,10 +259,10 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
GetScreen()->SetCurItem(
Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
Import_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
else
GetScreen()->SetCurItem(
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
Create_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
}
else if( (DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE)
&& (DrawStruct->m_Flags != 0) )
......@@ -277,7 +277,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
s_CmpNameList, TRUE ) );
s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
......@@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PLACE_POWER_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
GetScreen()->SetCurItem(
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
......@@ -318,17 +318,15 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
/***************************************************************************/
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/***************************************************************************/
/** Function OnLeftDClick
* called on a double click event from the drawpanel mouse handler
* if an editable item is found (text, component)
* Call the suitable dialog editor.
* Id a creat command is in progress:
* Id a create command is in progress:
* validate and finish the command
*/
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
wxPoint pos = GetPosition();
......@@ -336,19 +334,18 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state )
{
case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
DrawStruct = SchematicGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
break;
// Element localis�
switch( DrawStruct->Type() )
{
case DRAW_SHEET_STRUCT_TYPE:
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
InstallNextScreen( (SCH_SHEET*) DrawStruct );
break;
case TYPE_SCH_COMPONENT:
......@@ -376,12 +373,12 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
}
break; // end case 0
break;
case ID_BUS_BUTT:
case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
if( DrawStruct && ( DrawStruct->m_Flags & IS_NEW ) )
EndSegment( DC );
break;
}
......
/******************************************************************/
/* onrightclick.cpp - creation du menu popup appele par le bouton */
/* droit de la souris */
/******************************************************************/
/********************/
/* onrightclick.cpp */
/********************/
#include "fctsys.h"
#include "common.h"
......@@ -18,16 +17,13 @@
#include "class_library.h"
/* functions to add commands and submenus depending on the item */
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
static void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
WinEDA_SchematicFrame* frame );
static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
WinEDA_SchematicFrame* frame );
static void AddMenusForHierchicalSheet( wxMenu* PopMenu,
DrawSheetStruct* Sheet );
static void AddMenusForPinSheet( wxMenu* PopMenu,
Hierarchical_PIN_Sheet_Struct* PinSheet );
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
......@@ -40,22 +36,19 @@ static void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
WinEDA_SchematicFrame* aFrame );
/*****************************************************************/
/* Prepare context menu when a click on the right mouse button occurs.
*
* This menu is then added to the list of zoom commands.
*/
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
/*****************************************************************/
/* Prepare le menu PullUp affich� par un click sur le bouton droit
* de la souris.
* Ce menu est ensuite compl�t� par la liste des commandes de ZOOM
*/
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive =
(GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
// Do not start a block command on context menu.
DrawPanel->m_CanStartBlock = -1;
if( BlockActive )
{
......@@ -64,14 +57,15 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
return true;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) // Just try to locate items at cursor position
// Try to locate items at cursor position.
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = SchematicGeneralLocateAndDisplay( false );
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{
Hierarchical_PIN_Sheet_Struct* slabel;
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
GetScreen()->m_Curseur );
SCH_SHEET_PIN* slabel;
slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct,
GetScreen()->m_Curseur );
if( slabel )
DrawStruct = slabel;
}
......@@ -170,9 +164,11 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
if( flags )
break;
// Many fields are inside a component. If this is the case, add the component menu
SCH_COMPONENT* Component = LocateSmallestComponent(
(SCH_SCREEN*) GetScreen() );
// Many fields are inside a component. If this is the case, add the
// component menu
SCH_COMPONENT* Component =
LocateSmallestComponent( (SCH_SCREEN*) GetScreen() );
if( Component )
{
PopMenu->AppendSeparator();
......@@ -187,7 +183,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
case DRAW_SEGMENT_STRUCT_TYPE:
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
switch( DrawStruct->GetLayer() )
{
case LAYER_WIRE:
......@@ -210,19 +206,18 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break;
case DRAW_SHEET_STRUCT_TYPE:
AddMenusForHierchicalSheet( PopMenu, (DrawSheetStruct*) DrawStruct );
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) DrawStruct );
break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
AddMenusForPinSheet( PopMenu,
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
AddMenusForPinSheet( PopMenu, (SCH_SHEET_PIN*) DrawStruct );
break;
default:
wxString msg;
msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown \
DrawType %d" ),
DrawStruct->Type() );
DrawStruct->Type() );
DisplayError( this, msg );
break;
}
......@@ -232,13 +227,8 @@ DrawType %d" ),
}
/*************************************************************************/
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
{
/*************************************************************************/
/* Add menu commands for a component field (like value, reference)
*/
if( !Field->m_Flags )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
_( "Move Field" ), move_text_xpm );
......@@ -249,13 +239,8 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
}
/**************************************************************************/
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{
/**************************************************************************/
/* Add menu commands for a component
*/
if( Component->Type() != TYPE_SCH_COMPONENT )
{
wxASSERT( 0 );
......@@ -289,7 +274,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
msg, move_xpm );
}
// add menu orient et sous menu:
wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT );
......@@ -311,7 +295,8 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
_( "Orient Component" ), orient_xpm );
wxMenu* editmenu = new wxMenu;
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT );
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg,
edit_component_xpm );
......@@ -369,19 +354,15 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
}
/*******************************************************************/
void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
{
/*******************************************************************/
/* Add menu commands for a Global Label
*/
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !GLabel->m_Flags )
{
msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
msg = AddHotkeyName( _( "Move Global Label" ),
s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
msg, move_text_xpm );
}
......@@ -405,20 +386,15 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
}
/*******************************************************************/
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
{
/*******************************************************************/
/* Add menu commands for a hierarchical Label
*/
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !HLabel->m_Flags )
{
msg = AddHotkeyName( _(
"Move Hierarchical Label" ), s_Schematic_Hokeys_Descr,
msg = AddHotkeyName( _( "Move Hierarchical Label" ),
s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
msg, move_text_xpm );
......@@ -443,19 +419,15 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
}
/*****************************************************************/
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
{
/*****************************************************************/
/* Add menu commands for a Label
*/
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !Label->m_Flags )
{
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
msg, move_text_xpm );
}
......@@ -479,13 +451,8 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
}
/*****************************************************************/
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
{
/*****************************************************************/
/* Add menu commands for a Text (a comment)
*/
wxMenu* menu_change_type = new wxMenu;
if( !Text->m_Flags )
......@@ -519,14 +486,9 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
}
/*****************************************************************/
void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a junction
*/
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
if( !is_new )
......@@ -551,14 +513,9 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
}
/*****************************************************************/
void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a wire
*/
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur;
......@@ -589,7 +546,7 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
add_line_label_xpm );
// Place Global label command only if the cursor is over one end of the Wire:
// Add global label command only if the cursor is over one end of the wire.
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
......@@ -597,14 +554,9 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
}
/*****************************************************************/
void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a Bus
*/
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur;
......@@ -626,7 +578,7 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
add_line_label_xpm );
// Place Global label command only if the cursor is over one end of the Bus:
// Add global label command only if the cursor is over one end of the bus.
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y)
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
......@@ -634,13 +586,8 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
}
/************************************************************************/
void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
{
/************************************************************************/
/* Add menu commands for a Sheet
*/
if( !Sheet->m_Flags )
{
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ENTER_SHEET,
......@@ -674,14 +621,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
}
/************************************************************************/
void AddMenusForPinSheet( wxMenu* PopMenu,
Hierarchical_PIN_Sheet_Struct* PinSheet )
void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
{
/************************************************************************/
/* Add menu commands for a Pin Sheet (or Sheet label)
*/
if( !PinSheet->m_Flags )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_PINSHEET,
_( "Move PinSheet" ), move_xpm );
......@@ -695,13 +636,8 @@ void AddMenusForPinSheet( wxMenu* PopMenu,
}
/**********************************************************************/
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
{
/**********************************************************************/
/* Add menu commands for block
*/
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), cancel_xpm );
......@@ -713,7 +649,9 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) // After a block move (that is also a block selection) one can reselect a block function:
// After a block move (that is also a block selection) one can reselect
// a block function.
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ),
......@@ -735,11 +673,9 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
}
/**********************************************************************/
void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
WinEDA_SchematicFrame* aFrame )
{
/**********************************************************************/
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ),
delete_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER,
......
/***************************************************
* operations_on_item_lists.cpp
* operations_on_item_lists.cpp
* functions used in block commands, on lists of schematic items:
* move, mirror, delete anc copy
****************************************************/
......@@ -15,18 +15,14 @@
#include "protos.h"
/* Exported Functions */
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
void DeleteItemsInList( WinEDA_DrawPanel* panel,
void DeleteItemsInList( WinEDA_DrawPanel* panel,
PICKED_ITEMS_LIST& aItemsList );
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector );
/*****************************************************************************
* Routine to Mirror objects. *
*****************************************************************************/
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
{
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
......@@ -38,12 +34,11 @@ void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
}
/** Function MoveItemsInList
* Move a list of items to a givent move vector
* @param aItemsList = list of picked items
* @param aMoveVector = the move vector value
*/
* Move a list of items to a givent move vector
* @param aItemsList = list of picked items
* @param aMoveVector = the move vector value
*/
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
{
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
......@@ -54,7 +49,6 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
}
/** function DeleteItemsInList
* delete schematic items in aItemsList
* deleted items are put in undo list
......@@ -69,17 +63,17 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
itemWrapper.m_PickedItem = item;
itemWrapper.m_PickedItem = item;
itemWrapper.m_UndoRedoStatus = UR_DELETED;
if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
{
/* this item is depending on a sheet, and is not in global list */
wxMessageBox( wxT(
"DeleteItemsInList() err: unexpected DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
wxMessageBox( wxT( "DeleteItemsInList() err: unexpected \
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
#if 0
Hierarchical_PIN_Sheet_Struct* pinlabel = (Hierarchical_PIN_Sheet_Struct*) item;
SCH_SHEET_PIN* pinlabel = (SCH_SHEET_PIN*) item;
frame->DeleteSheetLabel( false, pinlabel->m_Parent );
itemWrapper.m_PickedItem = pinlabel->m_Parent;
itemWrapper.m_PickedItem = pinlabel->m_Parent;
itemWrapper.m_UndoRedoStatus = UR_CHANGED;
itemsList.PushItem( itemWrapper );
#endif
......@@ -99,13 +93,10 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
}
/*********************************************************************************/
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
/*********************************************************************************/
/* Routine to delete an object from global drawing object list.
* Object is put in Undo list
*/
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
......@@ -115,17 +106,16 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
{
/* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */
frame->SaveCopyInUndoList( (SCH_ITEM*)( (Hierarchical_PIN_Sheet_Struct
*) DrawStruct )->GetParent(),
UR_CHANGED );
/* This structure is attached to a node, and is not accessible by
* the global list directly. */
frame->SaveCopyInUndoList(
(SCH_ITEM*) ( (SCH_SHEET_PIN*) DrawStruct )-> GetParent(),
UR_CHANGED );
frame->DeleteSheetLabel( DC ? true : false,
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
(SCH_SHEET_PIN*) DrawStruct );
return;
}
else /* structure classique */
else
{
screen->RemoveFromDrawList( DrawStruct );
......@@ -140,14 +130,12 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
}
/*****************************************************************************/
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
/*****************************************************************************/
/* Routine to copy a new entity of an object for each object in list and reposition it.
/* Routine to copy a new entity of an object for each object in list and
* reposition it.
* Return the new created object list in aItemsList
*/
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector )
{
SCH_ITEM* newitem;
......@@ -178,7 +166,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, co
case DRAW_SHEET_STRUCT_TYPE:
{
DrawSheetStruct* sheet = (DrawSheetStruct*) newitem;
SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->m_TimeStamp = GetTimeStamp();
sheet->SetSon( NULL );
break;
......@@ -200,13 +188,10 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, co
}
/************************************************************/
SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
/************************************************************/
/* Routine to create a new copy of given struct.
* The new object is not put in draw list (not linked)
*/
SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
{
SCH_ITEM* NewDrawStruct = NULL;
......@@ -263,7 +248,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
break;
case DRAW_SHEET_STRUCT_TYPE:
NewDrawStruct = ( (DrawSheetStruct*) DrawStruct )->GenCopy();
NewDrawStruct = ( (SCH_SHEET*) DrawStruct )->GenCopy();
break;
default:
......@@ -279,5 +264,3 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
NewDrawStruct->m_Image = DrawStruct;
return NewDrawStruct;
}
......@@ -17,19 +17,13 @@
/* Local Variables : */
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
Hierarchical_PIN_Sheet_Struct* Struct );
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
SCH_SHEET_PIN* Struct );
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode );
/***/
/**********************************************************/
static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
/**********************************************************/
/* Routine de dessin des symboles de "No Connexion" ..
*/
{
#define DELTA (DRAWNOCONNECT_SIZE / 2)
int pX, pY;
......@@ -44,10 +38,7 @@ static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
}
/*************************************************/
static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
/*************************************************/
/* Polt a component */
{
LIB_COMPONENT* Entry;
int TransMat[2][2];
......@@ -69,21 +60,17 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
}
/*************************************************************/
/* Plot field text.
* Input:
* DrawLibItem: pointer to the component
* FieldNumber: Number Field
* IsMulti: No Null flag if there are several sides by housing.
* Only useful for the field to add a reference to this one
* The identification from (A, B ...)
* DrawMode: trace mode
*/
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode )
/**************************************************************/
/* Routine de trace des textes type Field du composant.
* entree:
* DrawLibItem: pointeur sur le composant
* FieldNumber: Numero du champ
* IsMulti: flag Non Null si il y a plusieurs parts par boitier.
* n'est utile que pour le champ reference pour ajouter a celui ci
* l'identification de la part ( A, B ... )
* DrawMode: mode de trace
*/
{
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
EDA_Colors color = UNSPECIFIED_COLOR;
......@@ -96,9 +83,10 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
if( field->IsVoid() )
return;
/* Calculate the text orientation, according to the component orientation/mirror */
/* Calculate the text orientation, according to the component
* orientation/mirror */
int orient = field->m_Orient;
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
if( DrawLibItem->m_Transform[0][1] ) // Rotate component 90 deg.
{
if( orient == TEXT_ORIENT_HORIZ )
orient = TEXT_ORIENT_VERT;
......@@ -106,16 +94,17 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
orient = TEXT_ORIENT_HORIZ;
}
/* Calculate the text justification, according to the component orientation/mirror
/* Calculate the text justification, according to the component
* orientation/mirror
* this is a bit complicated due to cumulative calculations:
* - numerous cases (mirrored or not, rotation)
* - the DrawGraphicText function recalculate also H and H vustifications
* according to the text orienation.
* - When a component is mirrored, the text is not mirrored and justifications
* are complicated to calculate
* - the DrawGraphicText function recalculate also H and H justifications
* according to the text orientation.
* - When a component is mirrored, the text is not mirrored and
* justifications are complicated to calculate
* so the more easily way is to use no justifications ( Centered text )
* and use GetBoundaryBox to know the text coordinate considered as centered
*/
*/
EDA_Rect BoundaryBox = field->GetBoundaryBox();
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
......@@ -131,7 +120,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
hjustify, vjustify,
thickness, field->m_Italic, field->m_Bold );
}
else /* We plt the reference, for a multiple parts per package */
else /* We plot the reference, for a multiple parts per package */
{
/* Adding A, B ... to the reference */
wxString Text;
......@@ -152,13 +141,8 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
}
/**************************************************************************/
void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
int len, int orient, int Shape )
/**************************************************************************/
/* Trace la pin du symbole en cours de trace
*/
{
int MapX1, MapY1, x1, y1;
EDA_Colors color = UNSPECIFIED_COLOR;
......@@ -226,14 +210,16 @@ void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
{
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 ) );
plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM ) );
plotter->finish_to( wxPoint( x1, y1 ) );
}
else /* MapX1 = 0 */
{
plotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->move_to( wxPoint( x1,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->finish_to( wxPoint( x1, y1 ) );
......@@ -246,25 +232,20 @@ void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
plotter->move_to( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
plotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
plotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 ) );
}
else /* MapX1 = 0 */
{
plotter->move_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
plotter->finish_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->finish_to( wxPoint( x1,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
}
}
}
/********************************************************************/
static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
/********************************************************************/
/*
* Routine de trace des Textes, Labels et Global-Labels.
* Les textes peuvent avoir 4 directions.
*/
{
static std::vector <wxPoint> Poly;
......@@ -299,42 +280,39 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
plotter->text( pos,
color, txt, aSchText->m_Orient, aSchText->m_Size,
aSchText->m_HJustify, aSchText->m_VJustify,
thickness, aSchText->m_Italic, aSchText->m_Bold );
plotter->text( pos, color, txt, aSchText->m_Orient,
aSchText->m_Size, aSchText->m_HJustify,
aSchText->m_VJustify, thickness,
aSchText->m_Italic, aSchText->m_Bold );
pos += offset;
}
delete (list);
}
else
plotter->text( textpos,
color, aSchText->m_Text, aSchText->m_Orient, aSchText->m_Size,
aSchText->m_HJustify, aSchText->m_VJustify,
thickness, aSchText->m_Italic, aSchText->m_Bold );
plotter->text( textpos, color, aSchText->m_Text, aSchText->m_Orient,
aSchText->m_Size, aSchText->m_HJustify,
aSchText->m_VJustify, thickness, aSchText->m_Italic,
aSchText->m_Bold );
/* Draw graphic symbol for global or hierachical labels */
/* Draw graphic symbol for global or hierarchical labels */
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
{
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly,
aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
if( aSchText->Type() == TYPE_SCH_HIERLABEL )
{
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly,
aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
}
/*****************************************************************************************/
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
/****************************************************************************************/
/* Plot a Hierarchical_PIN_Sheet
*/
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
SCH_SHEET_PIN* aHierarchical_PIN )
{
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
int posx, tposx, posy, size;
......@@ -361,10 +339,10 @@ static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
int thickness = aHierarchical_PIN->GetPenSize();
plotter->set_current_line_width( thickness );
plotter->text( wxPoint( tposx, posy ), txtcolor,
aHierarchical_PIN->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
side, GR_TEXT_VJUSTIFY_CENTER,
thickness, aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
plotter->text( wxPoint( tposx, posy ), txtcolor, aHierarchical_PIN->m_Text,
TEXT_ORIENT_HORIZ, wxSize( size, size ),
side, GR_TEXT_VJUSTIFY_CENTER, thickness,
aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
/* Draw the associated graphic symbol */
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
......@@ -373,12 +351,9 @@ static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
}
/*************************************************/
static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
/*************************************************/
/* Routine de dessin du bloc type hierarchie */
static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
{
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
SCH_SHEET_PIN* SheetLabelStruct;
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
wxSize size;
wxString Text;
......@@ -424,9 +399,9 @@ static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor,
Text, TEXT_ORIENT_HORIZ, size,
plotter->text( wxPoint( Struct->m_Pos.x,
Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false );
......@@ -442,9 +417,7 @@ static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
}
/********************************************************/
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
/*********************************************************/
{
while( aDrawlist ) /* Plot each item in draw list */
{
......@@ -489,7 +462,8 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
#undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) aDrawlist )
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_DIAMETER, FILLED_SHAPE );
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_DIAMETER,
FILLED_SHAPE );
break;
case TYPE_SCH_TEXT:
......@@ -514,7 +488,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
break;
case DRAW_SHEET_STRUCT_TYPE:
PlotSheetStruct( plotter, (DrawSheetStruct*) aDrawlist );
PlotSheetStruct( plotter, (SCH_SHEET*) aDrawlist );
break;
case DRAW_NOCONNECT_STRUCT_TYPE:
......
......@@ -12,7 +12,7 @@
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "plotdxf.h"
#endif
......@@ -28,8 +28,7 @@
#include "protos.h"
/* Variables locales : */
static bool Plot_Sheet_Ref = TRUE;
static bool Plot_Sheet_Ref = TRUE;
#include "plotdxf.h"
......@@ -37,12 +36,7 @@ static bool Plot_Sheet_Ref = TRUE;
////@end XPM images
/***********************************************************/
void WinEDA_SchematicFrame::ToPlot_DXF( wxCommandEvent& event )
/***********************************************************/
/* fonction relai de creation de la frame de dialogue pour trace Postscript
*/
{
wxPoint pos;
......@@ -71,16 +65,17 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotDXFFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_PlotDXFFrame, wxDialog )
////@begin WinEDA_PlotDXFFrame event table entries
EVT_BUTTON( ID_PLOT_DXF_CURRENT_EXECUTE, WinEDA_PlotDXFFrame::OnPlotDXFCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_DXF_CURRENT_EXECUTE,
WinEDA_PlotDXFFrame::OnPlotDXFCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_DXF_ALL_EXECUTE, WinEDA_PlotDXFFrame::OnPlotDXFAllExecuteClick )
EVT_BUTTON( ID_PLOT_DXF_ALL_EXECUTE,
WinEDA_PlotDXFFrame::OnPlotDXFAllExecuteClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotDXFFrame::OnCancelClick )
////@end WinEDA_PlotDXFFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PlotDXFFrame constructors
*/
......@@ -91,11 +86,11 @@ WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame()
WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame( WinEDA_DrawFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
m_Parent = parent;
PlotDXFColorOpt = false;
......@@ -108,33 +103,36 @@ WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame( WinEDA_DrawFrame* parent,
*/
bool WinEDA_PlotDXFFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_PlotDXFFrame member initialisation
m_PlotDXFColorOption = NULL;
m_Plot_Sheet_Ref = NULL;
m_Plot_Sheet_Ref = NULL;
m_btClose = NULL;
m_MsgBox = NULL;
m_MsgBox = NULL;
////@end WinEDA_PlotDXFFrame member initialisation
////@begin WinEDA_PlotDXFFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
Centre();
////@end WinEDA_PlotDXFFrame creation
return true;
}
/*!
* Control creation for WinEDA_PlotDXFFrame
*/
......@@ -146,51 +144,86 @@ void WinEDA_PlotDXFFrame::CreateControls()
WinEDA_PlotDXFFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemDialog1->SetSizer( itemBoxSizer2 );
wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Plot Options:"));
wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
itemBoxSizer3->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxArrayString m_PlotDXFColorOptionStrings;
m_PlotDXFColorOptionStrings.Add(_("B/W"));
m_PlotDXFColorOptionStrings.Add(_("Color"));
m_PlotDXFColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, m_PlotDXFColorOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PlotDXFColorOption->SetSelection(0);
itemStaticBoxSizer6->Add(m_PlotDXFColorOption, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer6Static =
new wxStaticBox( itemDialog1, wxID_ANY, _( "Plot Options:" ) );
wxStaticBoxSizer* itemStaticBoxSizer6 =
new wxStaticBoxSizer( itemStaticBoxSizer6Static, wxVERTICAL );
itemBoxSizer3->Add( itemStaticBoxSizer6,
0,
wxALIGN_CENTER_VERTICAL | wxALL,
5 );
m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_Plot_Sheet_Ref->SetValue(false);
itemStaticBoxSizer6->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PLOT_DXF_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
wxArrayString m_PlotDXFColorOptionStrings;
m_PlotDXFColorOptionStrings.Add( _( "B/W" ) );
m_PlotDXFColorOptionStrings.Add( _( "Color" ) );
m_PlotDXFColorOption =
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot Color:" ),
wxDefaultPosition, wxDefaultSize,
m_PlotDXFColorOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PlotDXFColorOption->SetSelection( 0 );
itemStaticBoxSizer6->Add( m_PlotDXFColorOption, 0, wxGROW | wxALL, 5 );
m_Plot_Sheet_Ref =
new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Print Sheet Ref" ),
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_Plot_Sheet_Ref->SetValue( false );
itemStaticBoxSizer6->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton11 = new wxButton( itemDialog1,
ID_PLOT_DXF_CURRENT_EXECUTE,
_( "&Plot Page" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemButton11->SetDefault();
itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, ID_PLOT_DXF_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE );
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
itemBoxSizer10->Add( itemButton11, 0, wxGROW | wxALL, 5 );
wxButton* itemButton12 = new wxButton( itemDialog1,
ID_PLOT_DXF_ALL_EXECUTE,
_( "Plot A&LL" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer10->Add( itemButton12, 0, wxGROW | wxALL, 5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "Close" ),
wxDefaultPosition, wxDefaultSize,
0 );
itemBoxSizer10->Add( m_btClose, 0, wxGROW | wxALL, 5 );
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Messages :" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer2->Add( itemStaticText15,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
wxDefaultPosition, wxSize( -1, 200 ),
wxTE_MULTILINE );
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL | wxFIXED_MINSIZE, 5 );
// Set validators
m_PlotDXFColorOption->SetValidator( wxGenericValidator(& PlotDXFColorOpt) );
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) );
m_PlotDXFColorOption->SetValidator( wxGenericValidator( &PlotDXFColorOpt ) );
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator( &Plot_Sheet_Ref ) );
////@end WinEDA_PlotDXFFrame content construction
SetFocus(); // make the ESC work
......@@ -215,8 +248,9 @@ wxBitmap WinEDA_PlotDXFFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PlotDXFFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PlotDXFFrame bitmap retrieval
}
......@@ -229,8 +263,9 @@ wxIcon WinEDA_PlotDXFFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PlotDXFFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PlotDXFFrame icon retrieval
}
......@@ -276,35 +311,37 @@ void WinEDA_PlotDXFFrame::OnCancelClick( wxCommandEvent& event )
/*****************************************/
void WinEDA_PlotDXFFrame::InitOptVars()
/*****************************************/
{
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
/*****************************************/
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
PlotDXFColorOpt = m_PlotDXFColorOption->GetSelection();
}
/*************************************************************/
void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
/*************************************************************/
{
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
wxString PlotFileName;
/*************************************************************/
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
wxString PlotFileName;
Ki_PageDescr* PlotSheet;
wxPoint plot_offset;
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
* In complex hierarchies, we must setup references and others parameters
* in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets
*/
EDA_SheetList SheetList( NULL );
sheetpath = SheetList.GetFirst();
DrawSheetPath list;
while (true)
while( true )
{
if( AllPages )
{
......@@ -324,12 +361,13 @@ void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
sheetpath = SheetList.GetNext();
}
PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10;
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".dxf" );
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
".dxf" );
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
......@@ -344,20 +382,16 @@ void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
}
/*****************************************************************************************/
void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale)
/*****************************************************************************************/
/* Trace en format DXF. d'une feuille de dessin
*/
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale )
{
wxString msg;
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
......@@ -371,23 +405,23 @@ void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg );
DXF_PLOTTER *plotter = new DXF_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0);
plotter->set_color_mode(PlotDXFColorOpt);
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( sheet );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( PlotDXFColorOpt );
/* Init : */
plotter->set_creator(wxT("EESchema-DXF"));
plotter->set_filename(FileName);
plotter->start_plot(output_file);
plotter->set_creator( wxT( "EESchema-DXF" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
if( Plot_Sheet_Ref )
{
plotter->set_color( BLACK );
plotter->set_color( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
PlotDrawlist(plotter, screen->EEDrawList);
PlotDrawlist( plotter, screen->EEDrawList );
/* fin */
plotter->end_plot();
......
......@@ -7,12 +7,12 @@
// Created: 04/02/2006 16:54:19
// RCS-ID:
// Copyright: License GNU
// Licence:
// License:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 04/02/2006 16:54:19
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "plothpgl.h"
#endif
......@@ -35,11 +35,11 @@
////@begin XPM images
////@end XPM images
/* Variables locales : */
FILE* PlotOutput; /* exportee dans printps.cc */
int HPGL_SizeSelect;
FILE* PlotOutput;
int HPGL_SizeSelect;
enum PageFormatReq {
enum PageFormatReq
{
PAGE_DEFAULT = 0,
PAGE_SIZE_A4,
PAGE_SIZE_A3,
......@@ -70,13 +70,11 @@ static Ki_PageDescr* Plot_sheet_list[] =
&g_Sheet_user
};
/* Routines Locales */
/**************************************************************/
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
/**************************************************************/
{
/**************************************************************/
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
HPGL_frame->ShowModal();
......@@ -99,24 +97,29 @@ BEGIN_EVENT_TABLE( WinEDA_PlotHPGLFrame, wxDialog )
////@begin WinEDA_PlotHPGLFrame event table entries
EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected )
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED,
WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED,
WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED,
WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE,
WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE,
WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick )
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET,
WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
////@end WinEDA_PlotHPGLFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PlotHPGLFrame constructors
*/
......@@ -150,27 +153,29 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent,
const wxSize& size,
long style )
{
////@begin WinEDA_PlotHPGLFrame member initialisation
m_SizeOption = NULL;
////@begin WinEDA_PlotHPGLFrame member initialization
m_SizeOption = NULL;
m_ButtPenWidth = NULL;
m_ButtPenSpeed = NULL;
m_ButtPenNum = NULL;
m_ButtPenNum = NULL;
m_PlotOrgPosition_X = NULL;
m_PlotOrgPosition_Y = NULL;
m_btClose = NULL;
m_MsgBox = NULL;
////@end WinEDA_PlotHPGLFrame member initialisation
m_MsgBox = NULL;
////@end WinEDA_PlotHPGLFrame member initialization
////@begin WinEDA_PlotHPGLFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
Centre();
////@end WinEDA_PlotHPGLFrame creation
return true;
}
......@@ -187,100 +192,212 @@ void WinEDA_PlotHPGLFrame::CreateControls()
WinEDA_PlotHPGLFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
wxArrayString m_SizeOptionStrings;
m_SizeOptionStrings.Add(_("Sheet Size"));
m_SizeOptionStrings.Add(_("Page Size A4"));
m_SizeOptionStrings.Add(_("Page Size A3"));
m_SizeOptionStrings.Add(_("Page Size A2"));
m_SizeOptionStrings.Add(_("Page Size A1"));
m_SizeOptionStrings.Add(_("Page Size A0"));
m_SizeOptionStrings.Add(_("Page Size A"));
m_SizeOptionStrings.Add(_("Page Size B"));
m_SizeOptionStrings.Add(_("Page Size C"));
m_SizeOptionStrings.Add(_("Page Size D"));
m_SizeOptionStrings.Add(_("Page Size E"));
m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection(0);
itemBoxSizer4->Add(m_SizeOption, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer6, 0, wxALIGN_TOP|wxALL, 5);
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:"));
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 );
itemStaticBoxSizer7->Add(m_ButtPenWidth, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 );
itemStaticBoxSizer7->Add(m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 );
itemStaticBoxSizer7->Add(m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:"));
wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL);
itemBoxSizer6->Add(itemStaticBoxSizer14, 0, wxALIGN_LEFT|wxALL, 5);
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add(m_PlotOrgPosition_X, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemDialog1->SetSizer( itemBoxSizer2 );
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add(m_PlotOrgPosition_Y, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer20, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5);
wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
wxArrayString m_SizeOptionStrings;
m_SizeOptionStrings.Add( _( "Sheet Size" ) );
m_SizeOptionStrings.Add( _( "Page Size A4" ) );
m_SizeOptionStrings.Add( _( "Page Size A3" ) );
m_SizeOptionStrings.Add( _( "Page Size A2" ) );
m_SizeOptionStrings.Add( _( "Page Size A1" ) );
m_SizeOptionStrings.Add( _( "Page Size A0" ) );
m_SizeOptionStrings.Add( _( "Page Size A" ) );
m_SizeOptionStrings.Add( _( "Page Size B" ) );
m_SizeOptionStrings.Add( _( "Page Size C" ) );
m_SizeOptionStrings.Add( _( "Page Size D" ) );
m_SizeOptionStrings.Add( _( "Page Size E" ) );
m_SizeOption =
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot page size:" ),
wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings,
1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 );
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(
itemDialog1, wxID_ANY, _( "Pen control:" ) );
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(
itemStaticBoxSizer7Static,
wxVERTICAL );
itemBoxSizer6->Add( itemStaticBoxSizer7,
0,
wxALIGN_CENTER_HORIZONTAL | wxALL,
5 );
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Pen Width ( mils )" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemStaticBoxSizer7->Add(
itemStaticText8,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_ButtPenWidth =
new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T( "1" ),
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS | wxSP_WRAP, 1, 100, 1 );
itemStaticBoxSizer7->Add( m_ButtPenWidth,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Pen Speed ( cm/s )" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemStaticBoxSizer7->Add( itemStaticText10,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_ButtPenSpeed =
new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T( "1" ),
wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS,
1, 100, 1 );
itemStaticBoxSizer7->Add( m_ButtPenSpeed,
0,
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT |
wxBOTTOM,
5 );
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Pen Number" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemStaticBoxSizer7->Add( itemStaticText12,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED,
_T( "1" ), wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS, 1, 8, 1 );
itemStaticBoxSizer7->Add( m_ButtPenNum,
0,
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT |
wxBOTTOM,
5 );
wxStaticBox* itemStaticBoxSizer14Static =
new wxStaticBox( itemDialog1, wxID_ANY, _( "Page offset:" ) );
wxStaticBoxSizer* itemStaticBoxSizer14 =
new wxStaticBoxSizer( itemStaticBoxSizer14Static, wxVERTICAL );
itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 );
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Plot Offset X" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemStaticBoxSizer14->Add( itemStaticText15,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1,
_T( "" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( m_PlotOrgPosition_X,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Plot Offset Y" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemStaticBoxSizer14->Add( itemStaticText17,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer20,
0,
wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM,
5 );
wxButton* itemButton21 = new wxButton( itemDialog1,
ID_PLOT_HPGL_CURRENT_EXECUTE,
_( "&Plot Page" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemButton21->SetDefault();
itemBoxSizer20->Add(itemButton21, 0, wxGROW|wxALL, 5);
wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer20->Add(itemButton22, 0, wxGROW|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer20->Add(m_btClose, 0, wxGROW|wxALL, 5);
itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer20->Add(itemButton25, 0, wxGROW|wxALL, 5);
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE );
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL, 5);
itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 );
wxButton* itemButton22 = new wxButton( itemDialog1,
ID_PLOT_HPGL_ALL_EXECUTE,
_( "Plot A&LL" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Close" ),
wxDefaultPosition, wxDefaultSize,
0 );
itemBoxSizer20->Add( m_btClose, 0, wxGROW | wxALL, 5 );
itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxButton* itemButton25 = new wxButton( itemDialog1,
ID_PLOT_ACCEPT_OFFSET,
_( "&Accept Offset" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 );
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
wxDefaultPosition, wxSize( -1, 110 ),
wxTE_MULTILINE );
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 );
// Set validators
m_SizeOption->SetValidator( wxGenericValidator(& HPGL_SizeSelect) );
m_ButtPenWidth->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Diam) );
m_ButtPenSpeed->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Speed) );
m_ButtPenNum->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Num) );
m_SizeOption->SetValidator( wxGenericValidator( &HPGL_SizeSelect ) );
m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
m_Pen_Diam ) );
m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
m_Pen_Speed ) );
m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
m_Pen_Num ) );
////@end WinEDA_PlotHPGLFrame content construction
SetFocus(); // Make ESC key working
}
......@@ -290,7 +407,8 @@ void WinEDA_PlotHPGLFrame::CreateControls()
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE
*/
void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event )
void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick(
wxCommandEvent& event )
{
HPGL_Plot( event );
}
......@@ -312,10 +430,13 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event )
void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in
// WinEDA_PlotHPGLFrame.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in
// WinEDA_PlotHPGLFrame.
}
......@@ -347,8 +468,9 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PlotHPGLFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PlotHPGLFrame bitmap retrieval
}
......@@ -361,15 +483,14 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PlotHPGLFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PlotHPGLFrame icon retrieval
}
/***************************************************/
void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
/***************************************************/
{
wxString msg;
......@@ -380,7 +501,7 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_X->SetValue( msg );
msg = ReturnStringFromValue( g_UnitMetric,
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y,
Plot_sheet_list[HPGL_SizeSelect]-> m_Offset.y,
EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_Y->SetValue( msg );
......@@ -395,9 +516,7 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
}
/*****************************************************************/
void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
/*****************************************************************/
{
int ii = m_SizeOption->GetSelection();
......@@ -418,9 +537,7 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
}
/************************************************************/
void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event )
/************************************************************/
{
g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue();
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
......@@ -430,9 +547,7 @@ void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event )
}
/*********************************************************/
void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event )
/*********************************************************/
{
g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue();
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
......@@ -442,9 +557,7 @@ void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event )
}
/*******************************************************/
void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
/*******************************************************/
{
g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue();
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
......@@ -454,9 +567,7 @@ void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
}
/***********************************************************/
void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
/***********************************************************/
{
int Select_PlotAll = FALSE;
......@@ -477,14 +588,12 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
}
/*******************************************************************/
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
wxSize& SheetSize, wxPoint& SheetOffset )
/*******************************************************************/
/* Fonction calculant les dims et offsets de trace de la feuille selectionnee
* retourne:
/* Function calculates the offsets and dimensions of any trace of the
* selected sheet
*/
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
wxSize& SheetSize,
wxPoint& SheetOffset )
{
Ki_PageDescr* PlotSheet;
......@@ -498,29 +607,30 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
}
/***********************************************************************************/
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize )
/***********************************************************************************/
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll,
int HPGL_SheetSize )
{
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
wxString PlotFileName;
wxString PlotFileName;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
Ki_PageDescr* PlotSheet;
wxSize SheetSize;
wxPoint SheetOffset, PlotOffset;
wxSize SheetSize;
wxPoint SheetOffset, PlotOffset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
* In complex hierarchies, we must setup references and others parameters
* in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets
*/
EDA_SheetList SheetList( NULL );
sheetpath = SheetList.GetFirst();
DrawSheetPath list;
while (true)
while( true )
{
if( Select_PlotAll )
{
......@@ -540,22 +650,25 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
sheetpath = SheetList.GetNext();
}
ReturnSheetDims( screen, SheetSize, SheetOffset );
/* Calcul des echelles de conversion */
if (HPGL_SheetSize)
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
else
PlotSheet = screen->m_CurrentSheetDesc;
/* 10x because eeschema works in mils, not decimils */
double plot_scale = 10 * (double)PlotSheet->m_Size.x / (double)SheetSize.x;
/* calcul des offsets */
PlotOffset.x = -SheetOffset.x;
PlotOffset.y = -SheetOffset.y;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
/* Calculation of conversion scales. */
if( HPGL_SheetSize )
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
else
PlotSheet = screen->m_CurrentSheetDesc;
/* 10x because eeschema works in mils, not decimals */
double plot_scale = 10 * (double) PlotSheet->m_Size.x /
(double) SheetSize.x;
/* Calculate offsets */
PlotOffset.x = -SheetOffset.x;
PlotOffset.y = -SheetOffset.y;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() +
wxT( ".plt" );
SetLocaleTo_C_standard();
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset,
plot_scale );
SetLocaleTo_Default();
if( !Select_PlotAll )
......@@ -569,17 +682,16 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
}
/**************************************************************************/
void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint &offset,
double plot_scale)
/**************************************************************************/
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint& offset,
double plot_scale )
{
wxString msg;
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
......@@ -593,25 +705,24 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg );
HPGL_PLOTTER *plotter = new HPGL_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( offset, plot_scale, 0);
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( sheet );
plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
/* Init : */
plotter->set_creator(wxT("EESchema-HPGL"));
plotter->set_filename(FileName);
plotter->set_pen_speed(g_HPGL_Pen_Descr.m_Pen_Speed);
plotter->set_pen_number(g_HPGL_Pen_Descr.m_Pen_Num);
plotter->set_pen_diameter(g_HPGL_Pen_Descr.m_Pen_Diam);
plotter->set_pen_overlap(g_HPGL_Pen_Descr.m_Pen_Diam/2);
plotter->set_creator( wxT( "EESchema-HPGL" ) );
plotter->set_filename( FileName );
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
plotter->set_pen_number( g_HPGL_Pen_Descr.m_Pen_Num );
plotter->set_pen_diameter( g_HPGL_Pen_Descr.m_Pen_Diam );
plotter->set_pen_overlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
plotter->start_plot( output_file );
plotter->set_color( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
PlotDrawlist(plotter, screen->EEDrawList);
PlotDrawlist( plotter, screen->EEDrawList );
/* fin */
plotter->end_plot();
delete plotter;
SetLocaleTo_Default();
......@@ -619,6 +730,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
*/
......
......@@ -7,12 +7,12 @@
// Created: 01/02/2006 08:37:24
// RCS-ID:
// Copyright: GNU License
// Licence:
// License:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "plotps.h"
#endif
......@@ -34,8 +34,8 @@ enum PageFormatReq {
};
/* Variables locales : */
static int PS_SizeSelect = PAGE_SIZE_AUTO;
static bool Plot_Sheet_Ref = TRUE;
static int PS_SizeSelect = PAGE_SIZE_AUTO;
static bool Plot_Sheet_Ref = TRUE;
#include "plotps.h"
......@@ -43,12 +43,7 @@ static bool Plot_Sheet_Ref = TRUE;
////@end XPM images
/***********************************************************/
void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event )
/***********************************************************/
/* fonction relai de creation de la frame de dialogue pour trace Postscript
*/
{
wxPoint pos;
......@@ -77,16 +72,17 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotPSFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_PlotPSFrame, wxDialog )
////@begin WinEDA_PlotPSFrame event table entries
EVT_BUTTON( ID_PLOT_PS_CURRENT_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_PS_CURRENT_EXECUTE,
WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_PS_ALL_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick )
EVT_BUTTON( ID_PLOT_PS_ALL_EXECUTE,
WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotPSFrame::OnCancelClick )
////@end WinEDA_PlotPSFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PlotPSFrame constructors
*/
......@@ -120,25 +116,27 @@ bool WinEDA_PlotPSFrame::Create( wxWindow* parent,
const wxSize& size,
long style )
{
////@begin WinEDA_PlotPSFrame member initialisation
////@begin WinEDA_PlotPSFrame member initialization
m_SizeOption = NULL;
m_PlotPSColorOption = NULL;
m_Plot_Sheet_Ref = NULL;
m_Plot_Sheet_Ref = NULL;
m_btClose = NULL;
m_DefaultLineSizeCtrlSizer = NULL;
m_MsgBox = NULL;
////@end WinEDA_PlotPSFrame member initialisation
////@begin WinEDA_PlotPSFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
Centre();
////@end WinEDA_PlotPSFrame creation
return true;
}
......@@ -155,72 +153,110 @@ void WinEDA_PlotPSFrame::CreateControls()
WinEDA_PlotPSFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemDialog1->SetSizer( itemBoxSizer2 );
wxArrayString m_SizeOptionStrings;
m_SizeOptionStrings.Add(_("Auto"));
m_SizeOptionStrings.Add(_("Page Size A4"));
m_SizeOptionStrings.Add(_("Page Size A"));
m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection(0);
itemBoxSizer3->Add(m_SizeOption, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Plot Options:"));
wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
itemBoxSizer3->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxArrayString m_SizeOptionStrings;
m_SizeOptionStrings.Add( _( "Auto" ) );
m_SizeOptionStrings.Add( _( "Page Size A4" ) );
m_SizeOptionStrings.Add( _( "Page Size A" ) );
m_SizeOption =
new wxRadioBox( itemDialog1, ID_RADIOBOX1, _( "Plot page size:" ),
wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings,
1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
itemBoxSizer3->Add( m_SizeOption, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer6Static =
new wxStaticBox( itemDialog1, wxID_ANY, _( "Plot Options:" ) );
wxStaticBoxSizer* itemStaticBoxSizer6 =
new wxStaticBoxSizer( itemStaticBoxSizer6Static, wxVERTICAL );
itemBoxSizer3->Add( itemStaticBoxSizer6,
0,
wxALIGN_CENTER_VERTICAL | wxALL,
5 );
wxArrayString m_PlotPSColorOptionStrings;
m_PlotPSColorOptionStrings.Add(_("B/W"));
m_PlotPSColorOptionStrings.Add(_("Color"));
m_PlotPSColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PlotPSColorOption->SetSelection(0);
itemStaticBoxSizer6->Add(m_PlotPSColorOption, 0, wxGROW|wxALL, 5);
m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_Plot_Sheet_Ref->SetValue(false);
itemStaticBoxSizer6->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 5);
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PLOT_PS_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
m_PlotPSColorOptionStrings.Add( _( "B/W" ) );
m_PlotPSColorOptionStrings.Add( _( "Color" ) );
m_PlotPSColorOption =
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot Color:" ),
wxDefaultPosition, wxDefaultSize,
m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PlotPSColorOption->SetSelection( 0 );
itemStaticBoxSizer6->Add( m_PlotPSColorOption, 0, wxGROW | wxALL, 5 );
m_Plot_Sheet_Ref =
new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Print Sheet Ref" ),
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_Plot_Sheet_Ref->SetValue( false );
itemStaticBoxSizer6->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton11 = new wxButton( itemDialog1,
ID_PLOT_PS_CURRENT_EXECUTE,
_( "&Plot Page" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemButton11->SetDefault();
itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, ID_PLOT_PS_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
m_DefaultLineSizeCtrlSizer = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(m_DefaultLineSizeCtrlSizer, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE );
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
itemBoxSizer10->Add( itemButton11, 0, wxGROW | wxALL, 5 );
wxButton* itemButton12 = new wxButton( itemDialog1,
ID_PLOT_PS_ALL_EXECUTE,
_( "Plot A&LL" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer10->Add( itemButton12, 0, wxGROW | wxALL, 5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "Close" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add( m_btClose, 0, wxGROW | wxALL, 5 );
m_DefaultLineSizeCtrlSizer = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( m_DefaultLineSizeCtrlSizer, 0, wxGROW | wxALL, 5 );
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Messages :" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer2->Add( itemStaticText15,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
wxDefaultPosition, wxSize( -1, 200 ),
wxTE_MULTILINE );
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL | wxFIXED_MINSIZE, 5 );
// Set validators
m_SizeOption->SetValidator( wxGenericValidator(& PS_SizeSelect) );
m_PlotPSColorOption->SetValidator( wxGenericValidator(& PlotPSColorOpt) );
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) );
m_SizeOption->SetValidator( wxGenericValidator( &PS_SizeSelect ) );
m_PlotPSColorOption->SetValidator( wxGenericValidator( &PlotPSColorOpt ) );
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator( &Plot_Sheet_Ref ) );
////@end WinEDA_PlotPSFrame content construction
SetFocus(); // make the ESC work
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this, _(
"Default Line Width" ),
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this,
_( "Default Line Width" ),
g_DrawDefaultLineThickness,
g_UnitMetric, m_DefaultLineSizeCtrlSizer,
g_UnitMetric,
m_DefaultLineSizeCtrlSizer,
EESCHEMA_INTERNAL_UNIT );
}
......@@ -243,8 +279,9 @@ wxBitmap WinEDA_PlotPSFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PlotPSFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PlotPSFrame bitmap retrieval
}
......@@ -257,8 +294,9 @@ wxIcon WinEDA_PlotPSFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PlotPSFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PlotPSFrame icon retrieval
}
......@@ -302,41 +340,39 @@ void WinEDA_PlotPSFrame::OnCancelClick( wxCommandEvent& event )
}
/*****************************************/
void WinEDA_PlotPSFrame::InitOptVars()
/*****************************************/
{
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
PlotPSColorOpt = m_PlotPSColorOption->GetSelection();
PS_SizeSelect = m_SizeOption->GetSelection();
PS_SizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = m_DefaultLineSizeCtrl->GetValue();
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
/*************************************************************/
void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
/*************************************************************/
{
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
wxString PlotFileName;
Ki_PageDescr* PlotSheet, *RealSheet;
Ki_PageDescr* PlotSheet, * RealSheet;
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
* In complex hierarchies, we must setup references and others parameters
* in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets
*/
EDA_SheetList SheetList( NULL );
sheetpath = SheetList.GetFirst();
DrawSheetPath list;
while (true)
while( true )
{
if( AllPages )
{
......@@ -356,28 +392,31 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
sheetpath = SheetList.GetNext();
}
PlotSheet = screen->m_CurrentSheetDesc;
switch (pagesize)
{
case PAGE_SIZE_A:
switch( pagesize )
{
case PAGE_SIZE_A:
RealSheet = &g_Sheet_A;
break;
case PAGE_SIZE_A4:
RealSheet = &g_Sheet_A4;
break;
case PAGE_SIZE_AUTO:
default:
break;
case PAGE_SIZE_A4:
RealSheet = &g_Sheet_A4;
break;
case PAGE_SIZE_AUTO:
default:
RealSheet = PlotSheet;
break;
}
break;
}
double scalex = (double) RealSheet->m_Size.x / PlotSheet->m_Size.x;
double scaley = (double) RealSheet->m_Size.y / PlotSheet->m_Size.y;
double scale = 10 * MIN(scalex, scaley);
double scale = 10 * MIN( scalex, scaley );
plot_offset.x = 0;
plot_offset.y = 0;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".ps" );
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
".ps" );
PlotOneSheetPS( PlotFileName, screen, RealSheet, plot_offset, scale );
......@@ -392,20 +431,16 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
}
/*****************************************************************************************/
void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale)
/*****************************************************************************************/
/* Trace en format PS. d'une feuille de dessin
*/
double scale )
{
wxString msg;
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
......@@ -419,26 +454,25 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg );
PS_PLOTTER *plotter = new PS_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0);
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( sheet );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode(PlotPSColorOpt);
plotter->set_color_mode( PlotPSColorOpt );
/* Init : */
plotter->set_creator(wxT("EESchema-PS"));
plotter->set_filename(FileName);
plotter->start_plot(output_file);
plotter->set_creator( wxT( "EESchema-PS" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
if( Plot_Sheet_Ref )
{
plotter->set_color( BLACK );
{
plotter->set_color( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
}
PlotDrawlist(plotter, screen->EEDrawList);
PlotDrawlist( plotter, screen->EEDrawList );
/* fin */
plotter->end_plot();
delete plotter;
SetLocaleTo_Default();
......
......@@ -12,9 +12,9 @@ class SCH_COMPONENT;
class BASE_SCREEN;
class SCH_SCREEN;
class SCH_ITEM;
class Hierarchical_PIN_Sheet_Struct;
class SCH_SHEET_PIN;
class PLOTTER;
class DrawSheetStruct;
class SCH_SHEET;
class LIB_PIN;
......@@ -121,14 +121,13 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
int SearchMask );
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
const wxPoint& pos );
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos );
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
const wxPoint& RefPos,
SCH_COMPONENT** libpart = NULL );
Hierarchical_PIN_Sheet_Struct* LocateAnyPinSheet( const wxPoint& RefPos,
SCH_ITEM* DrawList );
SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos,
SCH_ITEM* DrawList );
/***************/
......@@ -192,7 +191,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
/***************/
/* DELSHEET.CPP */
/***************/
void DeleteSubHierarchy( DrawSheetStruct* Sheet, bool confirm_deletion );
void DeleteSubHierarchy( SCH_SHEET* Sheet, bool confirm_deletion );
bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
/* free the draw list screen->EEDrawList and the subhierarchies
......
......@@ -23,12 +23,12 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
/**
* Function ReadTextDescr
* Reads the data structures for a Text (Comment, label, Hlabel and Hlabel
* from a FILE in "*.brd" format.
* from a FILE in "*.sch" format.
* @param aFile The FILE to read.
* @param aLine The buffer used to read the first line of description.
* @param aBufsize The size of aLine.
* @param aLineNum a pointer to the line count.
* @return a poiner to the new created obect if success reading else NULL.
* @return a poiner to the new created object if success reading else NULL.
*/
SCH_ITEM* Struct = NULL;
char Name1[256];
......@@ -71,8 +71,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
if( Name1[0] == 'L' ) // Reading a simple label (SCH_LABEL item)
{
SCH_LABEL* TextStruct =
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
SCH_LABEL* TextStruct = new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->SetSchematicTextOrientation( orient );
......@@ -80,14 +79,16 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
{
thickness = atol( Name3 );
TextStruct->m_Bold = (thickness != 0);
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
TextStruct->m_Width =
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
}
Struct = TextStruct;
if( stricmp( Name2, "Italic" ) == 0 )
TextStruct->m_Italic = 1;
}
else if( Name1[0] == 'G' && aSchematicFileVersion > '1' ) // Reading a global label (SCH_GLOBALLABEL item)
else if( Name1[0] == 'G' && aSchematicFileVersion > '1' )
{
// Reading a global label (SCH_GLOBALLABEL item).
SCH_GLOBALLABEL* TextStruct =
new SCH_GLOBALLABEL( pos, CONV_FROM_UTF8( text ) );
......@@ -96,7 +97,8 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
TextStruct->SetSchematicTextOrientation( orient );
TextStruct->m_Shape = NET_INPUT;
TextStruct->m_Bold = (thickness != 0);
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
TextStruct->m_Width =
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT;
......@@ -109,18 +111,22 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
if( stricmp( Name3, "Italic" ) == 0 )
TextStruct->m_Italic = 1;
}
else if( (Name1[0] == 'H') // Reading a hierarchical label (SCH_HIERLABEL item)
|| (Name1[0] == 'G' && aSchematicFileVersion == '1') ) //in schematic file version 1, glabels were actually hierarchal labels.
else if( (Name1[0] == 'H')
|| (Name1[0] == 'G' && aSchematicFileVersion == '1') )
{
SCH_HIERLABEL* TextStruct =
new SCH_HIERLABEL( pos, CONV_FROM_UTF8( text ) );
// Reading a hierarchical label (SCH_HIERLABEL item).
// In schematic file version 1, glabels were actually hierarchical
// labels.
SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL( pos,
CONV_FROM_UTF8( text ) );
Struct = TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->SetSchematicTextOrientation( orient );
TextStruct->m_Shape = NET_INPUT;
TextStruct->m_Shape = NET_INPUT;
TextStruct->m_Bold = (thickness != 0);
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
TextStruct->m_Width =
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT;
......@@ -156,7 +162,8 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
{
thickness = atol( Name3 );
TextStruct->m_Bold = (thickness != 0);
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
TextStruct->m_Width =
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
}
if( strnicmp( Name2, "Italic", 6 ) == 0 )
......@@ -168,30 +175,30 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
}
/* Fonction utilisee par LoadEEFile().
* Lit les lignes relatives a la description d'une feuille de hierarchie
/* Function used by LoadEEFile().
* Get the lines for a description of a piece of hierarchy.
*/
int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
int* aLineNum, BASE_SCREEN* Window )
{
int ii, fieldNdx, size;
int ii, fieldNdx, size;
char Name1[256], Char1[256], Char2[256];
DrawSheetStruct* SheetStruct;
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct, * OldSheetLabel = NULL;
SCH_SHEET* SheetStruct;
SCH_SHEET_PIN* SheetLabelStruct, * OldSheetLabel = NULL;
int Failed = FALSE;
char* ptcar;
SheetStruct = new DrawSheetStruct();
SheetStruct = new SCH_SHEET();
SheetStruct->m_TimeStamp = GetTimeStamp();
//sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the hierarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array.
//must be a duplicate, references just work for a two-layer structure.
//this is accomplished through the Sync() function.
// sheets are added to the EEDrawList like other schematic components.
// however, in order to preserve the hierarchy (through m_Parent pointers),
// a duplicate of the sheet is added to m_SubSheet array.
// must be a duplicate, references just work for a two-layer structure.
// this is accomplished through the Sync() function.
if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */
if( Line[0] == '$' ) /* Line should be "$Sheet" */
{
*aLineNum++;
if( fgets( Line, 256 - 1, f ) == 0 )
......@@ -217,7 +224,7 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
}
/* Read fields */
for( ; ; ) /* Analyse des lignes "Fn "texte" .." */
for( ; ; ) /* Analysis of lines "Fn" text. */
{
*aLineNum++;
if( fgets( Line, 256 - 1, f ) == NULL )
......@@ -233,11 +240,12 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
break;
sscanf( Line + 1, "%d", &fieldNdx );
/* Lecture du champ :
* si fieldNdx >= 2 : Fn "texte" t s posx posy
* sinon F0 "texte" pour sheetname
* et F1 "texte" pour filename */
/* Read the field:
* If fieldNdx> = 2: Fn "text" t s posx posy
* If F0 "text" for SheetName
* F1 and "text" for filename
*/
ptcar = Line; while( *ptcar && (*ptcar != '"') )
ptcar++;
......@@ -297,9 +305,8 @@ error line %d, aborted\n" ),
if( fieldNdx > 1 )
{
SheetLabelStruct =
new Hierarchical_PIN_Sheet_Struct( SheetStruct, wxPoint( 0, 0 ),
CONV_FROM_UTF8( Name1 ) );
SheetLabelStruct = new SCH_SHEET_PIN( SheetStruct, wxPoint( 0, 0 ),
CONV_FROM_UTF8( Name1 ) );
if( SheetStruct->m_Label == NULL )
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
......@@ -307,7 +314,7 @@ error line %d, aborted\n" ),
OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
OldSheetLabel = SheetLabelStruct;
/* Lecture des coordonnees */
/* Read coordinates. */
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2,
&SheetLabelStruct->m_Pos.x, &SheetLabelStruct->m_Pos.y,
&size ) != 5 )
......@@ -324,23 +331,27 @@ error line %d, aborted\n" ),
size = DEFAULT_SIZE_TEXT;
SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size;
/* Mise a jour des cadrage et type */
switch( Char1[0] )
{
case 'I':
SheetLabelStruct->m_Shape = NET_INPUT; break;
SheetLabelStruct->m_Shape = NET_INPUT;
break;
case 'O':
SheetLabelStruct->m_Shape = NET_OUTPUT; break;
SheetLabelStruct->m_Shape = NET_OUTPUT;
break;
case 'B':
SheetLabelStruct->m_Shape = NET_BIDI; break;
SheetLabelStruct->m_Shape = NET_BIDI;
break;
case 'T':
SheetLabelStruct->m_Shape = NET_TRISTATE; break;
SheetLabelStruct->m_Shape = NET_TRISTATE;
break;
case 'U':
SheetLabelStruct->m_Shape = NET_UNSPECIFIED; break;
SheetLabelStruct->m_Shape = NET_UNSPECIFIED;
break;
}
if( Char2[0] == 'R' )
......@@ -361,14 +372,12 @@ error line %d, aborted\n" ),
Window->EEDrawList = SheetStruct;
SheetStruct->SetParent( Window );
}
return Failed; /* Fin lecture 1 composant */
return Failed;
}
/******************************************************************/
/* Analyse de l'entete du schema ( dims feuille, cartouche..)
*/
/******************************************************************/
/* Read the schematic header. */
bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
int* aLineNum, BASE_SCREEN* Window )
{
......@@ -384,7 +393,7 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
wxSize PageSize;
sscanf( Line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
/* Recherche de la descr correspondante: */
wxString pagename = CONV_FROM_UTF8( Text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{
......@@ -402,17 +411,15 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
if( SheetFormatList[ii] == NULL )
{
/* Erreur ici: descr non trouvee */
aMsgDiag.Printf( wxT( "EESchema file Dims Caract error line %d, \aborted\n" ),
aMsgDiag.Printf( wxT( "EESchema file dimension definition error \
line %d, \aAbort reading file.\n" ),
*aLineNum );
aMsgDiag << CONV_FROM_UTF8( Line );
DisplayError( frame, aMsgDiag );
}
/* Ajuste ecran */
Window->m_CurrentSheetDesc = wsheet;
/* Recheche suite et fin de descr */
for( ; ; )
{
if( GetLine( f, Line, aLineNum, 1024 ) == NULL )
......@@ -485,8 +492,8 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
}
/* Fonction utilisee par LoadEEFile().
* Lit les lignes relatives a la description d'un composant en schema
/* Function used by LoadEEFile ().
* Get the lines for a description of a schematic component.
*/
int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
int* aLineNum, BASE_SCREEN* Window )
......@@ -512,7 +519,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
return TRUE;
}
/* Traitement de la 1ere ligne de description */
if( sscanf( &Line[1], "%s %s", Name1, Name2 ) != 2 )
{
aMsgDiag.Printf(
......@@ -585,24 +591,21 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
component->GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
}
/* Traitement des autres lignes de description */
/* Ces lignes commencent par:
* "P " = position
* "U " = Num Unit, et Conversion
* "Fn" = Champs ( n = 0.. = numero de champ )
* "Ar" = AlternateReference, in the case of multiple sheets
* referring to one schematic file.
/* Parse component description
* These lines begin with:
* "P" = Position
* U = Num Unit and Conversion
* "Fn" = Fields (0 .. n = = number of field)
* "Ar" = Alternate reference in the case of multiple sheets referring to
* one schematic file.
*/
/* Lecture des champs */
for( ; ; )
{
*aLineNum++;
if( fgets( Line, 256 - 1, f ) == NULL )
return TRUE;
if( Line[0] == 'U' ) /* Lecture num multi, conversion et time stamp */
if( Line[0] == 'U' )
{
sscanf( Line + 1, "%d %d %lX",
&component->m_Multi, &component->m_Convert,
......@@ -613,8 +616,9 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
sscanf( Line + 1, "%d %d",
&component->m_Pos.x, &component->m_Pos.y );
// Set fields position to a default position (that is the component position
// For existing fields, the real position will be set later
// Set fields position to a default position (that is the
// component position. For existing fields, the real position
// will be set later
for( int i = 0; i<component->GetFieldCount(); ++i )
{
if( component->GetField( i )->m_Text.IsEmpty() )
......@@ -662,7 +666,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
FieldUserName[0] = 0;
/* Lecture du champ */
ptcar = Line;
while( *ptcar && (*ptcar != '"') )
......@@ -780,7 +783,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
break;
}
/* Lecture multi et position du composant */
if( sscanf( Line, "%d %d %d", &component->m_Multi,
&component->m_Pos.x, &component->m_Pos.y ) != 3 )
{
......@@ -791,7 +793,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
return Failed;
}
/* Lecture de la matrice de miroir / rotation */
*aLineNum++;
if( (fgets( Line, 256 - 1, f ) == NULL)
|| (sscanf( Line, "%d %d %d %d",
......@@ -828,5 +829,5 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
component->SetParent( Window );
}
return Failed; /* Fin lecture 1 composant */
return Failed;
}
/*********************************************/
/* eesave.cpp Module to Save EESchema files */
/* eesave.cpp Module to Save EESchema files */
/*********************************************/
#include "fctsys.h"
......@@ -18,15 +18,13 @@
#include <boost/foreach.hpp>
/* Fonctions Locales */
static void SaveLayers( FILE* f );
/* Variables locales */
/*****************************************************************************
* Routine to save an EESchema file. *
* FileSave controls how the file is to be saved - under what name. *
* Returns TRUE if the file has been saved. *
* Routine to save an EESchema file. *
* FileSave controls how the file is to be saved - under what name. *
* Returns TRUE if the file has been saved. *
*****************************************************************************/
bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
{
......@@ -106,16 +104,13 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
}
/*****************************************/
bool SCH_SCREEN::Save( FILE* aFile ) const
/*****************************************/
/**
* 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 "*.sch" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool SCH_SCREEN::Save( FILE* aFile ) const
{
wxString Name, msg;
Ki_PageDescr* PlotSheet;
......@@ -145,9 +140,10 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( PlotSheet->m_Name ),
PlotSheet->m_Size.x, PlotSheet->m_Size.y );
/* Write ScreenNumber and NumberOfScreen; not very meaningfull for SheetNumber and Sheet Count
* in a complex hierarchy, but usefull in simple hierarchy and flat hierarchy
* Used also to serach the root sheet ( ScreenNumber = 1 ) withing the files
/* Write ScreenNumber and NumberOfScreen; not very meaningfull for
* SheetNumber and Sheet Countin a complex hierarchy, but usefull in
* simple hierarchy and flat hierarchy. Used also to serach the root
* sheet ( ScreenNumber = 1 ) within the files
*/
fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen );
fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) );
......@@ -177,14 +173,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
}
/****************************/
static void SaveLayers( FILE* f )
/****************************/
/* Save a Layer Structure to a file
* theses infos are not used in eeschema
*/
static void SaveLayers( FILE* f )
{
fprintf( f, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers, g_LayerDescr.CurrentLayer );
fprintf( f, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer );
fprintf( f, "EELAYER END\n" );
}
/******************************************************/
/* schedit.cpp: fonctions generales de la schematique */
/******************************************************/
/*****************/
/* schedit.cpp */
/*****************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -18,11 +18,6 @@
#include "class_library.h"
/*****************************************************************************
*
* Traite les selections d'outils et les commandes appelees du menu POPUP
*
*****************************************************************************/
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
......@@ -118,9 +113,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_GETINFO_MARKER:
/* At this point: Do nothing. these commands do not need to stop the current command
* (mainly a block command) or reset the current state
* They will be executed later, in next switch structure.
/* At this point: Do nothing. these commands do not need to stop the
* current command (mainly a block command) or reset the current state
* They will be executed later, in next switch structure.
*/
break;
......@@ -134,7 +129,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
/* ne devrait pas etre execute, sauf bug: */
/* Should not be executed, except bug. */
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
{
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
......@@ -144,14 +140,16 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_SCH_DELETE_CMP:
case ID_POPUP_SCH_DELETE: // Stop the, current command, keep the current tool
case ID_POPUP_SCH_DELETE:
// Stop the current command but keep the current tool
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
break;
default: // Stop the current command, and deselect the current tool
default:
// Stop the current command and deselect the current tool
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
......@@ -162,9 +160,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
}
// End switch commande en cours
switch( id ) // Command execution:
switch( id )
{
case ID_HIERARCHY:
InstallHierarchyFrame( &dc, pos );
......@@ -380,32 +376,34 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema();
ReSizeSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
TestDanglingEnds( screen->EEDrawList, &dc );
break;
case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
EditSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
break;
case ID_POPUP_IMPORT_GLABEL:
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
GetScreen()->SetCurItem( Import_PinSheet( (DrawSheetStruct*)screen->GetCurItem(), &dc ) );
if ( screen->GetCurItem()
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
GetScreen()->SetCurItem(
Import_PinSheet( (SCH_SHEET*)screen->GetCurItem(), &dc ) );
break;
case ID_POPUP_SCH_CLEANUP_SHEET:
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
( (DrawSheetStruct*) screen->GetCurItem() )->CleanupSheet( this, true );
if ( screen->GetCurItem()
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true );
break;
case ID_POPUP_SCH_EDIT_PINSHEET:
Edit_PinSheet( (Hierarchical_PIN_Sheet_Struct*) screen->GetCurItem(), &dc );
Edit_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_MOVE_PINSHEET:
DrawPanel->MouseToCursorSchema();
StartMove_PinSheet( (Hierarchical_PIN_Sheet_Struct*)
screen->GetCurItem(), &dc );
StartMove_PinSheet( (SCH_SHEET_PIN*)screen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
......@@ -446,12 +444,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
screen->m_Curseur ) )
break;
// Ensure the block selection contains the segment, or one end of the segment
// the initial rect is only one point (w = h = 0)
// Ensure the block selection contains the segment, or one end of
// the segment. The initial rect is only one point (w = h = 0)
// The rect must contains one or 2 ends.
// If only one end is selected, this is a drag Node
// if no ends selected, we adjust the rect area to contain the whole segment
// This works fine only for H and V segments and only if they do not cross a component
// if no ends selected, we adjust the rect area to contain the
// whole segment. This works fine only for H and V segments and
// only if they do not cross a component
// TODO: a better way to drag only wires
EDA_DrawLineStruct* segm = (EDA_DrawLineStruct*)screen->GetCurItem();
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
......@@ -664,7 +663,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
EDA_BaseStruct* DrawStruct = screen->GetCurItem();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
InstallNextScreen( (SCH_SHEET*) DrawStruct );
}
}
break;
......@@ -741,13 +740,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_SCH_GETINFO_MARKER:
if( screen->GetCurItem() && screen->GetCurItem()->Type() == TYPE_MARKER_SCH )
if( screen->GetCurItem()
&& screen->GetCurItem()->Type() == TYPE_MARKER_SCH )
((MARKER_SCH*)screen->GetCurItem())->DisplayMarkerInfo( this );
break;
default: // Log error:
DisplayError( this,
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
break;
}
......@@ -759,9 +759,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
}
/*************************************************************************************/
void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
/*************************************************************************************/
{
if( DrawStruct == NULL )
return;
......@@ -792,7 +790,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
break;
case DRAW_SHEET_STRUCT_TYPE:
StartMoveSheet( (DrawSheetStruct*) DrawStruct, DC );
StartMoveSheet( (SCH_SHEET*) DrawStruct, DC );
break;
case DRAW_NOCONNECT_STRUCT_TYPE:
......
......@@ -138,8 +138,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_SHEET_STRUCT_TYPE:
#undef SOURCE
#undef DEST
#define SOURCE ( (DrawSheetStruct*) aItem )
#define DEST ( (DrawSheetStruct*) aImage )
#define SOURCE ( (SCH_SHEET*) aItem )
#define DEST ( (SCH_SHEET*) aImage )
DEST->SwapData( SOURCE );
break;
......@@ -154,8 +154,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
#undef SOURCE
#undef DEST
#define SOURCE ( (Hierarchical_PIN_Sheet_Struct*) aItem )
#define DEST ( (Hierarchical_PIN_Sheet_Struct*) aImage )
#define SOURCE ( (SCH_SHEET_PIN*) aItem )
#define DEST ( (SCH_SHEET_PIN*) aImage )
EXCHG( SOURCE->m_Edge, DEST->m_Edge );
EXCHG( SOURCE->m_Shape, DEST->m_Shape );
break;
......
/******************************************************************/
/* schframe.cpp - fonctions des classes du type WinEDA_DrawFrame */
/******************************************************************/
/******************/
/* schframe.cpp */
/******************/
#ifdef __GNUG__
#pragma implementation
......@@ -84,8 +84,10 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_SCHEMATIC_UNDO, WinEDA_SchematicFrame::GetSchematicFromUndoList )
EVT_TOOL( ID_SCHEMATIC_REDO, WinEDA_SchematicFrame::GetSchematicFromRedoList )
EVT_TOOL( ID_SCHEMATIC_UNDO,
WinEDA_SchematicFrame::GetSchematicFromUndoList )
EVT_TOOL( ID_SCHEMATIC_REDO,
WinEDA_SchematicFrame::GetSchematicFromRedoList )
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
......@@ -99,7 +101,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
// Tools et boutons de Schematique, Vertical toolbar:
// Tools and buttons for vertical toolbar.
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
WinEDA_SchematicFrame::Process_Special_Functions )
......@@ -107,7 +109,8 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions )
// Tools et boutons de Schematique, Options toolbar:
// Tools and buttons options toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_SchematicFrame::OnSelectOptionToolbar )
......@@ -135,7 +138,6 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
WinEDA_SchematicFrame::OnUpdateUnits )
END_EVENT_TABLE()
/****************/
/* Constructor */
/****************/
......@@ -157,7 +159,7 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_LibeditFrame = NULL; // Component editor frame.
m_ViewlibFrame = NULL; // Frame for browsing component libraries
m_DefaultSchematicFileName = wxT( "noname.sch" );
m_ShowAllPins = false;
m_ShowAllPins = false;
CreateScreens();
......@@ -172,10 +174,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
/* Get config */
LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
// Internalize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
......@@ -189,39 +191,39 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
ReCreateOptToolbar();
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz);
wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
m_auimgr.AddPane(m_VToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane(m_OptionsToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left());
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
m_auimgr.AddPane(DrawPanel,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane(MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......@@ -254,33 +256,36 @@ DrawSheetPath* WinEDA_SchematicFrame::GetSheet()
/****************************************************/
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
{
/****************************************************/
/** Function SetSheetNumberAndCount
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
* must be called after a delete or add sheet command, and when entering a sheet
* must be called after a delete or add sheet command, and when entering a
* sheet
*/
{
SCH_SCREEN* screen = GetScreen();
EDA_ScreenList s_list;
/* Set the sheet count, and the sheet number (1 for root sheet)
*/
int sheet_count = g_RootSheet->CountSheets();
int SheetNumber = 1;
wxString current_sheetpath = m_CurrentSheet->Path();
EDA_SheetList SheetList;
int sheet_count = g_RootSheet->CountSheets();
int SheetNumber = 1;
wxString current_sheetpath = m_CurrentSheet->Path();
EDA_SheetList SheetList;
// Examine all sheets path to find the current sheets path,
// and count them from root to the current scheet path:
// and count them from root to the current sheet path:
DrawSheetPath* sheet;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst(); sheet != NULL;
sheet = SheetList.GetNext() )
{
wxString sheetpath = sheet->Path();
if( sheetpath == current_sheetpath ) // Current sheet path found
break;
SheetNumber++; // not found, increment sheet number before this current path
SheetNumber++; /* Not found, increment sheet
* number before this current
* path */
}
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
......@@ -310,10 +315,9 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
void WinEDA_SchematicFrame::CreateScreens()
{
/* creation des ecrans Sch , Lib */
if( g_RootSheet == NULL )
{
g_RootSheet = new DrawSheetStruct();
g_RootSheet = new SCH_SHEET();
}
if( g_RootSheet->m_AssociatedScreen == NULL )
{
......@@ -334,8 +338,8 @@ void WinEDA_SchematicFrame::CreateScreens()
/*****************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{
/*****************************************************************/
DrawSheetPath* sheet;
if( m_LibeditFrame ) // Can close component editor ?
......@@ -346,7 +350,8 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
EDA_SheetList SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst(); sheet != NULL;
sheet = SheetList.GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
break;
......@@ -375,7 +380,9 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
}
}
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
if( sheet->LastScreen() )
{
......@@ -384,12 +391,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
}
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
/* allof sub sheets are deleted, only the main sheet is useable */
/* all sub sheets are deleted, only the main sheet is usable */
m_CurrentSheet->Clear();
SaveSettings();
Destroy();
......@@ -398,8 +405,8 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/************************************/
int WinEDA_SchematicFrame::BestZoom()
/************************************/
{
/************************************/
int dx, dy;
wxSize size;
double zoom;
......@@ -409,7 +416,7 @@ int WinEDA_SchematicFrame::BestZoom()
size = DrawPanel->GetClientSize();
zoom = MAX( (double) dx / (double) size.x,
(double) dy / (double) size.y );
(double) dy / (double) size.y );
GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2;
......@@ -417,24 +424,27 @@ int WinEDA_SchematicFrame::BestZoom()
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
}
/*******************************************************************/
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
{
/*******************************************************************/
/** Function GetUniqueFilenameForCurrentSheet
* @return a filename that can be used in plot and print functions
* for the current screen anad sheet path.
* for the current screen and sheet path.
* This filename is unique and must be used insteed of the screen filename
* (or scheen filename) when one must creates file for each sheet in the heierarchy.
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than once
* (or sheet filename) when one must creates file for each sheet in the
* heierarchy.
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than
* once
* Name is <root sheet filename>-<sheet path>
* and has no extension.
* However if filename is too long name is <sheet filename>-<sheet number>
*/
{
wxFileName fn = g_RootSheet->GetFileName();
wxString filename = fn.GetName();
wxString filename = fn.GetName();
if ( (filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
{
filename += m_CurrentSheet->PathHumanReadable();
filename.Replace( wxT( "/" ), wxT( "-" ) );
......@@ -442,78 +452,92 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
}
else
{
filename << wxT("-") << GetScreen()->m_ScreenNumber;
filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
}
return filename;
}
/*****************************************************************************
* Enable or disable menu entry and toolbar buttons according to current
* conditions.
*****************************************************************************/
* Enable or disable menu entry and toolbar buttons according to current
* conditions.
*****************************************************************************/
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
{
bool enable = ( GetScreen() &&
GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable(enable);
bool enable = ( GetScreen()
&& GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable( enable );
m_HToolBar->EnableTool( wxID_CUT, enable );
m_HToolBar->EnableTool( wxID_COPY, enable );
}
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
{
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
}
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
{
if ( GetScreen() )
if( GetScreen() )
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
}
void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
{
if ( GetScreen() )
if( GetScreen() )
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
{
wxString tool_tip = g_HVLines ?
_( "Draw wires and busses in any direction" ) :
_( "Draw horizontal and vertical wires and busses only" );
_( "Draw wires and busses in any direction" ) :
_( "Draw horizontal and vertical wires and busses only" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
tool_tip );
}
void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event )
{
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
_( "Show hidden pins" );
_( "Show hidden pins" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
}
void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
}
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
{
bool is_metric = g_UnitMetric == MILLIMETRE ? true : false;
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, is_metric );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, !is_metric );
DisplayUnitsMsg();
}
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
{
wxString tool_tip = m_Draw_Grid ? _( "Hide grid" ) : _( "Show grid" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
......@@ -521,8 +545,8 @@ void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
/**************************************************************/
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
/**************************************************************/
{
/**************************************************************/
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
dlg->ShowModal();
......@@ -532,8 +556,8 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
/*********************************************************/
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
/*********************************************************/
{
/*********************************************************/
DIALOG_ERC* dlg = new DIALOG_ERC( this );
dlg->ShowModal();
......@@ -543,8 +567,8 @@ void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
/*******************************************************************/
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
/*******************************************************************/
{
/*******************************************************************/
int i;
if( m_NetlistFormat < NET_TYPE_PCBNEW )
......@@ -563,8 +587,8 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
/**********************************************************************/
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
/**********************************************************************/
{
/**********************************************************************/
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
dlg->ShowModal();
......@@ -574,8 +598,8 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
/*******************************************************************/
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
/*******************************************************************/
{
/*******************************************************************/
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
dlg->ShowModal();
......@@ -586,8 +610,8 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
/***************************************************************/
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
/***************************************************************/
{
/***************************************************************/
wxString fn;
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
......@@ -602,8 +626,8 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
/*******************************************************************/
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
/*******************************************************************/
{
/*******************************************************************/
ReadInputStuffFile();
DrawPanel->Refresh();
}
......@@ -611,24 +635,24 @@ void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
/****************************************************************/
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
/****************************************************************/
{
/****************************************************************/
LoadOneEEProject( wxEmptyString, true );
}
/*****************************************************************/
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
/*****************************************************************/
{
/*****************************************************************/
LoadOneEEProject( wxEmptyString, false );
}
/****************************************************************/
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
/****************************************************************/
{
/****************************************************************/
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
if( fn.IsOk() )
......@@ -643,9 +667,10 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
/***************************************************************/
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
/***************************************************************/
{
/***************************************************************/
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
fn.SetExt( NetlistFileExtension );
if( fn.IsOk() && fn.FileExists() )
......@@ -659,8 +684,8 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
/*************************************************************************/
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
/*************************************************************************/
{
/*************************************************************************/
if( m_ViewlibFrame )
{
m_ViewlibFrame->Show( TRUE );
......@@ -675,8 +700,8 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
/*************************************************************************/
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
/*************************************************************************/
{
/*************************************************************************/
if( m_LibeditFrame )
{
m_LibeditFrame->Show( TRUE );
......
......@@ -7,12 +7,12 @@
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright: License GNU
// Licence:
// License:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 08/02/2006 18:37:02
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "sheet.h"
#endif
......@@ -31,13 +31,12 @@
#include "protos.h"
/* Routines Locales */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */
static int s_SheetMindx, s_SheetMindy;
static wxPoint s_OldPos; /* Ancienne pos pour annulation ReSize ou move */
static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */
#include "sheet.h"
......@@ -65,7 +64,6 @@ EVT_BUTTON( wxID_OK, WinEDA_SheetPropertiesFrame::OnOkClick )
////@end WinEDA_SheetPropertiesFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_SheetPropertiesFrame constructors
*/
......@@ -75,13 +73,14 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame()
}
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawSheetStruct* currentsheet,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame(
WinEDA_SchematicFrame* parent,
SCH_SHEET* currentsheet,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
m_Parent = parent;
m_CurrentSheet = currentsheet;
......@@ -101,8 +100,12 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame*
* WinEDA_SheetPropertiesFrame creator
*/
bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_SheetPropertiesFrame member initialisation
m_FileNameWin = NULL;
......@@ -152,74 +155,103 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Filename:" ), wxDefaultPosition,
wxDefaultSize, 0 );
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Filename:" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer4->Add( itemStaticText5,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_FileNameWin =
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxSize( 300,
-1 ),
wxTE_PROCESS_ENTER );
itemBoxSizer4->Add( m_FileNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Sheetname:" ), wxDefaultPosition,
wxDefaultSize, 0 );
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition,
wxSize( 300, - 1 ), wxTE_PROCESS_ENTER );
itemBoxSizer4->Add( m_FileNameWin,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1,
wxID_STATIC,
_( "Sheetname:" ),
wxDefaultPosition,
wxDefaultSize,
0 );
itemBoxSizer4->Add( itemStaticText7,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_SheetNameWin =
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( 300,
-1 ), 0 );
itemBoxSizer4->Add( m_SheetNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition,
wxSize( 300, -1 ), 0 );
itemBoxSizer4->Add( m_SheetNameWin,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
_( "Size" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameTextSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_FileNameSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
_( "Size" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameTextSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
wxADJUST_MINSIZE,
5 );
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T( "" ),
wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer9->Add( m_SheetNameSize,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemBoxSizer2->Add( itemBoxSizer15,
0,
wxALIGN_CENTER_HORIZONTAL | wxALL,
5 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add( m_btClose, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _(
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK,
_( "&OK" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton17->SetDefault();
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Set validators
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE, &m_CurrentSheet->m_SheetName ) );
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE,
&m_CurrentSheet->m_SheetName ) );
////@end WinEDA_SheetPropertiesFrame content construction
......@@ -268,14 +300,11 @@ wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name )
}
/*****************************************************************************/
void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
/*****************************************************************************/
/** Function SheetPropertiesAccept
* Set the new sheets properties:
* sheetname and filename (text and size)
*/
void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
{
wxFileName fn;
wxString msg;
......@@ -291,23 +320,28 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
fn.SetExt( SchematicFileExtension );
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the sheet must have a valid associated filename,
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the
* sheet must have a valid associated filename,
* so we must call m_CurrentSheet->ChangeFileName to set a filename,
* AND always when a new sheet is created ( when m_CurrentSheet->m_AssociatedScreen is null ),
* AND always when a new sheet is created ( when
* m_CurrentSheet->m_AssociatedScreen is null ),
* to create or set an Associated Screen
*/
if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() )
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) )
{
msg = _(
"Changing a Filename can change all the schematic \
structures and cannot be undone.\nOk to continue renaming?" );
msg = _( "Changing a Filename can change all the schematic \
structures and cannot be undone.\nOk to continue renaming?" );
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
{ //do not prompt on a new sheet. in fact, we should not allow a sheet to be created
//without a valid associated filename to be read from.
{
// do not prompt on a new sheet. in fact, we should not allow a
// sheet to be created without a valid associated filename to be
// read from.
m_Parent->GetScreen()->ClearUndoRedoList();
m_CurrentSheet->ChangeFileName( m_Parent, fn.GetFullPath() ); // set filename and the associated screen
// set filename and the associated screen
m_CurrentSheet->ChangeFileName( m_Parent, fn.GetFullPath() );
}
}
......@@ -325,7 +359,7 @@ structures and cannot be undone.\nOk to continue renaming?"
if( ( m_CurrentSheet->m_SheetName.IsEmpty() ) )
{
m_CurrentSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ),
GetTimeStamp() );
GetTimeStamp() );
}
......@@ -333,10 +367,8 @@ structures and cannot be undone.\nOk to continue renaming?"
}
/*************************************************************************/
bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*************************************************************************/
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* Sheet, wxDC* DC )
{
WinEDA_SheetPropertiesFrame* frame;
bool edit = TRUE;
......@@ -360,14 +392,13 @@ bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
#define SHEET_MIN_WIDTH 500
#define SHEET_MIN_HEIGHT 150
/****************************************************************/
DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
/****************************************************************/
/* Routine de Creation d'une feuille de hierarchie (Sheet) */
/* Create hierarchy sheet. */
SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
{
g_ItemToRepeat = NULL;
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
SCH_SHEET* Sheet = new SCH_SHEET( GetScreen()->m_Curseur );
Sheet->m_Flags = IS_NEW | IS_RESIZED;
Sheet->m_TimeStamp = GetTimeStamp();
......@@ -390,11 +421,9 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
}
/*******************************************************************************/
void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*******************************************************************************/
void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC )
{
Hierarchical_PIN_Sheet_Struct* sheetlabel;
SCH_SHEET_PIN* sheetlabel;
if( Sheet == NULL )
return;
......@@ -403,26 +432,25 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{
DisplayError( this, wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
DisplayError( this,
wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
return;
}
GetScreen()->SetModify();
Sheet->m_Flags |= IS_RESIZED;
/* sauvegarde des anciennes valeurs */
s_OldPos.x = Sheet->m_Size.x;
s_OldPos.y = Sheet->m_Size.y;
/* Recalcul des dims min de la sheet */
s_SheetMindx = SHEET_MIN_WIDTH;
s_SheetMindy = SHEET_MIN_HEIGHT;
sheetlabel = Sheet->m_Label;
while( sheetlabel )
{
s_SheetMindx = MAX( s_SheetMindx,
(int) ( (sheetlabel->GetLength() +
1) * sheetlabel->m_Size.x ) );
(int) ( ( sheetlabel->GetLength() + 1 ) *
sheetlabel->m_Size.x ) );
s_SheetMindy = MAX( s_SheetMindy, sheetlabel->m_Pos.y - Sheet->m_Pos.y );
sheetlabel = sheetlabel->Next();
}
......@@ -433,11 +461,9 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
}
/*********************************************************************************/
void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*********************************************************************************/
void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* Sheet, wxDC* DC )
{
if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) )
if( ( Sheet == NULL ) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE ) )
return;
DrawPanel->CursorOff( DC );
......@@ -454,27 +480,26 @@ void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
}
/********************************************************/
/* Routine de deplacement (move) Sheet, lie au curseur.*/
/* Appele par GeneralControle grace a ManageCurseur. */
/********************************************************/
/* Move selected sheet with the cursor.
* Callback function use by ManageCurseur.
*/
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint move_vector;
Hierarchical_PIN_Sheet_Struct* SheetLabel;
BASE_SCREEN* screen = panel->GetScreen();
wxPoint move_vector;
SCH_SHEET_PIN* SheetLabel;
BASE_SCREEN* screen = panel->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*)
screen->GetCurItem();
SCH_SHEET* Sheet = (SCH_SHEET*) screen->GetCurItem();
/* Effacement du composant: tj apres depl curseur */
if( erase )
RedrawOneStruct( panel, DC, Sheet, g_XorMode );
if( Sheet->m_Flags & IS_RESIZED )
{
Sheet->m_Size.x = MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
Sheet->m_Size.y = MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
Sheet->m_Size.x =
MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
Sheet->m_Size.y =
MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
SheetLabel = Sheet->m_Label;
while( SheetLabel )
{
......@@ -493,32 +518,30 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
/****************************************/
/* Routine de sortie du Menu de Sheet */
/****************************************/
/* Complete sheet move. */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
{
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem();
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
SCH_SHEET* Sheet = (SCH_SHEET*) Screen->GetCurItem();
if( Sheet == NULL )
return;
/* Deplacement composant en cours */
if( Sheet->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
if( Sheet->m_Flags & IS_NEW )
{
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
SAFE_DELETE( Sheet );
}
else if( Sheet->m_Flags & IS_RESIZED ) /* resize en cours: on l'annule */
else if( Sheet->m_Flags & IS_RESIZED )
{
/* Resize in progress, cancel move. */
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
Sheet->m_Size.x = s_OldPos.x;
Sheet->m_Size.y = s_OldPos.y;
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0;
}
else if( Sheet->m_Flags & IS_MOVED ) /* move en cours: on l'annule */
else if( Sheet->m_Flags & IS_MOVED )
{
wxPoint curspos = Screen->m_Curseur;
Panel->GetScreen()->m_Curseur = s_OldPos;
......
......@@ -71,7 +71,7 @@ public:
/// Constructors
WinEDA_SheetPropertiesFrame( );
WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawSheetStruct * currentsheet,
SCH_SHEET * currentsheet,
wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION,
......@@ -118,7 +118,7 @@ public:
////@end WinEDA_SheetPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent;
DrawSheetStruct* m_CurrentSheet;
SCH_SHEET* m_CurrentSheet;
};
#endif
......
/**************************************************************************/
/* sheetlab.cpp create and edit the Hierarchical_PIN_Sheet_Struct items */
/**************************************************************************/
/**********************************************************/
/* sheetlab.cpp create and edit the SCH_SHEET_PIN items */
/**********************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -13,12 +13,11 @@
#include "protos.h"
/* Routines Locales */
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */
static int CurrentTypeLabel = NET_INPUT;
static int CurrentTypeLabel = NET_INPUT;
static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
/****************************************/
......@@ -26,30 +25,25 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
/****************************************/
/*****************************************************/
class WinEDA_PinSheetPropertiesFrame : public wxDialog
/*****************************************************/
{
private:
WinEDA_SchematicFrame* m_Parent;
Hierarchical_PIN_Sheet_Struct* m_CurrentPinSheet;
SCH_SHEET_PIN* m_CurrentPinSheet;
wxRadioBox* m_PinSheetType;
wxRadioBox* m_PinSheetShape;
WinEDA_GraphicTextCtrl* m_TextWin;
public:
// Constructor and destructor
WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
Hierarchical_PIN_Sheet_Struct* curr_pinsheet,
const wxPoint& framepos = wxPoint( -1, -1 ) );
public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos =
wxPoint( -1, -1 ) );
~WinEDA_PinSheetPropertiesFrame() { };
private:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
......@@ -60,14 +54,12 @@ BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog )
END_EVENT_TABLE()
/**********************************************************************************/
WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
WinEDA_SchematicFrame* parent,
Hierarchical_PIN_Sheet_Struct* curr_pinsheet,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos,
wxSize( 340, 220 ), DIALOG_STYLE )
/**********************************************************************************/
WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
WinEDA_SchematicFrame* parent,
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos,
wxSize( 340, 220 ), DIALOG_STYLE )
{
wxPoint pos;
wxString number;
......@@ -101,7 +93,8 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
#define NBSHAPES 5
wxString shape_list[NBSHAPES] =
{
_( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ), _( "Passive" )
_( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ),
_( "Passive" )
};
m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ),
wxDefaultPosition, wxSize( -1, -1 ),
......@@ -114,38 +107,34 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
}
/************************************************************************/
void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/************************************************************************/
void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
event ) )
{
EndModal( -1 );
}
/***********************************************************************************/
void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
/***********************************************************************************/
{
m_CurrentPinSheet->m_Text = m_TextWin->GetText();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y =
m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
EndModal( 0 );
}
/*****************************************************************/
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
/*****************************************************************/
{
Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
Panel->GetScreen()->GetCurItem();
SCH_SHEET_PIN* SheetLabel =
(SCH_SHEET_PIN*) Panel->GetScreen()->GetCurItem();
if( SheetLabel == NULL )
return;
if( SheetLabel->m_Flags & IS_NEW )
{ /* Nouveau Placement en cours, on l'efface */
{
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
SAFE_DELETE( SheetLabel );
}
......@@ -161,21 +150,17 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
}
/* Cette routine place un nouveau NetSheet ou place un ancien en cours
* de deplacement
* Si le NetSheet est nouveau, il est pointe par NewSheetLabel
*/
void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{
DrawSheetStruct* Sheet = (DrawSheetStruct*) GetParent();
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
if( m_Flags & IS_NEW ) /* ajout a la liste des structures */
if( m_Flags & IS_NEW )
{
if( Sheet->m_Label == NULL )
Sheet->m_Label = this;
else
{
Hierarchical_PIN_Sheet_Struct* pinsheet = Sheet->m_Label;
SCH_SHEET_PIN* pinsheet = Sheet->m_Label;
while( pinsheet )
{
if( pinsheet->Next() == NULL )
......@@ -191,7 +176,9 @@ void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* D
m_Flags = 0;
m_Pos.x = Sheet->m_Pos.x;
m_Edge = 0;
if( frame->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
if( frame->GetScreen()->m_Curseur.x
> ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
{
m_Edge = 1;
m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
......@@ -210,11 +197,8 @@ void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* D
}
/*******************************************************************************/
void WinEDA_SchematicFrame::StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC )
/*******************************************************************************/
/* Initialise un deplacement de NetSheet */
void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
wxDC* DC )
{
NetSheetTextSize = SheetLabel->m_Size;
CurrentTypeLabel = SheetLabel->m_Shape;
......@@ -226,19 +210,15 @@ void WinEDA_SchematicFrame::StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* S
}
/**********************************************************************/
/* Routine de deplacement du NetSheet actif selon la position souris */
/**********************************************************************/
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
panel->GetScreen()->GetCurItem();
SCH_SHEET_PIN* SheetLabel =
(SCH_SHEET_PIN*) panel->GetScreen()->GetCurItem();
if( SheetLabel == NULL )
return;
DrawSheetStruct* Sheet = (DrawSheetStruct*) SheetLabel->GetParent();
SCH_SHEET* Sheet = (SCH_SHEET*) SheetLabel->GetParent();
if( Sheet == NULL )
return;
......@@ -247,7 +227,9 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SheetLabel->m_Edge = 0;
SheetLabel->m_Pos.x = Sheet->m_Pos.x;
if( panel->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
if( panel->GetScreen()->m_Curseur.x
> ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
{
SheetLabel->m_Edge = 1;
SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
......@@ -263,11 +245,8 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
/***************************************************************************/
void WinEDA_SchematicFrame::Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC )
/***************************************************************************/
/* Modification du texte d'un net sheet */
void WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel,
wxDC* DC )
{
if( SheetLabel == NULL )
return;
......@@ -283,17 +262,13 @@ void WinEDA_SchematicFrame::Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetL
}
/***************************************************************/
Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
DrawSheetStruct* Sheet, wxDC* DC )
/**************************************************************/
/* Addition d'un nouveau PinSheet sur la feuille selectionnee, a l'endroit
* pointe par la souris
/* Add a new sheet pin to the sheet at the current cursor position.
*/
SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet,
wxDC* DC )
{
wxString Line, Text;
Hierarchical_PIN_Sheet_Struct* NewSheetLabel;
wxString Line, Text;
SCH_SHEET_PIN* NewSheetLabel;
switch( CurrentTypeLabel )
{
......@@ -321,14 +296,13 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
break;
}
Get_Message( Text, _("PinSheet"), Line, this );
Get_Message( Text, _( "PinSheet" ), Line, this );
if( Line.IsEmpty() )
return NULL;
GetScreen()->SetModify();
/* Creation en memoire */
NewSheetLabel = new Hierarchical_PIN_Sheet_Struct( Sheet, wxPoint( 0, 0 ), Line );
NewSheetLabel = new SCH_SHEET_PIN( Sheet, wxPoint( 0, 0 ), Line );
NewSheetLabel->m_Flags = IS_NEW;
NewSheetLabel->m_Size = NetSheetTextSize;
NewSheetLabel->m_Shape = CurrentTypeLabel;
......@@ -343,28 +317,28 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
}
/*****************************************************************************/
Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*****************************************************************************/
/* Permet de creer automatiquement les Sheet Labels a partir des Labels Globaux
* de la feuille de sous hierarchie correspondante
/* Automatically create a sheet labels from global labels for each node in
* the corresponding hierarchy.
*/
SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet,
wxDC* DC )
{
EDA_BaseStruct* DrawStruct;
Hierarchical_PIN_Sheet_Struct* NewSheetLabel, * SheetLabel = NULL;
SCH_HIERLABEL* HLabel = NULL;
EDA_BaseStruct* DrawStruct;
SCH_SHEET_PIN* NewSheetLabel, * SheetLabel = NULL;
SCH_HIERLABEL* HLabel = NULL;
if(!Sheet->m_AssociatedScreen) return NULL;
if( !Sheet->m_AssociatedScreen )
return NULL;
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
HLabel = NULL;
HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
continue;
HLabel = (SCH_HIERLABEL*) DrawStruct;
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
/* A global label has been found: check is there a corresponding
* sheet label. */
SheetLabel = Sheet->m_Label;
for( ; SheetLabel != NULL; SheetLabel = SheetLabel->Next() )
{
......@@ -374,22 +348,19 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheet
}
}
/* Ici si SheetLabel == NULL le G-Label n'a pas de SheetLabel corresp */
if( SheetLabel == NULL )
break;
}
if( (HLabel == NULL ) || SheetLabel )
{
DisplayError( this, _( "No New Hierarchal Label found" ), 10 );
DisplayError( this, _( "No new hierarchical labels found" ), 10 );
return NULL;
}
/* Ici H-Label n'a pas de SheetLabel corresp, on va le creer */
GetScreen()->SetModify();
/* Creation en memoire */
NewSheetLabel = new Hierarchical_PIN_Sheet_Struct( Sheet, wxPoint( 0, 0 ), HLabel->m_Text );
NewSheetLabel = new SCH_SHEET_PIN( Sheet, wxPoint( 0, 0 ), HLabel->m_Text );
NewSheetLabel->m_Flags = IS_NEW;
NewSheetLabel->m_Size = NetSheetTextSize;
CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
......@@ -403,19 +374,16 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheet
}
/**************************************************************/
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
Hierarchical_PIN_Sheet_Struct* aSheetLabelToDel )
/**************************************************************/
/*
* Routine de suppression de 1 Structure type (Hierarchical_PIN_Sheet_Struct.
* Cette Structure ne peut etre mise en pile "undelete" car il ne serait pas
* possible de la rattacher a la 'DrawSheetStruct' d'origine
* si aRedraw == true, effacement a l'ecran du dessin
* Remove sheet label.
*
* This sheet label can not be put in a pile "undelete" because it would not
* Possible to link it back it's 'SCH_SHEET' parent.
*/
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
SCH_SHEET_PIN* aSheetLabelToDel )
{
DrawSheetStruct* parent = (DrawSheetStruct*) aSheetLabelToDel->GetParent();
SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent();
wxASSERT( parent );
wxASSERT( parent->Type() == DRAW_SHEET_STRUCT_TYPE );
......@@ -426,10 +394,10 @@ void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
std::cout << "\n\n\n" << std::flush;
#endif
Hierarchical_PIN_Sheet_Struct* prev = NULL;
SCH_SHEET_PIN* prev = NULL;
SCH_SHEET_PIN* label = parent->m_Label;
Hierarchical_PIN_Sheet_Struct* label = parent->m_Label;
for( ; label; prev=label, label=label->Next() )
for( ; label; prev = label, label = label->Next() )
{
if( label == aSheetLabelToDel )
{
......
......@@ -21,14 +21,13 @@
#include "dialog_lib_edit_draw_item.h"
/* Routines locales */
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre );
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
/* Variables locales */
static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY;
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
......@@ -264,8 +263,7 @@ error" ) );
}
/*
* Routine de creation d'un nouvel element type LibraryDrawStruct
/* Create new library component graphic object.
*/
void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
{
......@@ -313,7 +311,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
/*
* Redraw the graphoc shape while moving
* Redraw the graphic shape while moving
*/
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC,
......@@ -329,7 +327,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
BASE_SCREEN* Screen = panel->GetScreen();
wxPoint pos;
/* Erase shape in the old positon*/
/* Erase shape in the old position*/
if( erase )
{
pos = ItemPreviousPos - StartCursor;
......@@ -361,10 +359,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
}
/****************************************************************/
/* Routine de Gestion des evenements souris lors de la creation */
/* d'un nouvel element type LibraryDrawStruct */
/****************************************************************/
/* Manage mouse events when creating new graphic object. */
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
int dx, dy;
......@@ -453,7 +448,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
( (LIB_SEGMENT*) item )->m_End = curr_pos;
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: /* Traite par des routines specifiques */
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
break;
default:
......@@ -488,11 +483,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*
* Place la structure courante en liste des structures du composant
* courant, si elle existe et redessine toujours celle ci
* Parametres: (tous globaux)
* m_drawItem
* m_component
* Place the new graphic object in the list of component drawing objects.
*/
void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
{
......@@ -501,7 +492,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
if( m_drawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{
if( StateDrawArc == 1 ) /* Trace d'arc en cours: doit etre termine */
if( StateDrawArc == 1 ) /* Trace arc under way must be completed. */
{
DisplayError( this, wxT( "Arc in progress.." ) );
return;
......@@ -575,36 +566,35 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
}
/***************************************************************/
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
/***************************************************************/
/* routine d'ajustage des parametres de l'arc en cours de trace
* calcule le centre, rayon, angles pour que l'arc en cours
* passe par les points ArcStartX,Y et ArcEndX,Y avec le centre le plus proche
* de la pos souris
* Remarque: le centre n'est evidemment pas sur la grille
/*
* Routine for adjusting the parameters of the arc currently being drawn.
* Calculates the center, radius, angles for the arc current
* Passes through the points ArcStartX, ArcEndX Y and Y with the nearest center
* of the mouse position.
* Note: The center is obviously not on the grid
*/
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
{
int dx, dy;
int cX, cY; /* Coord centre de l'arc */
int cX, cY;
int angle;
cX = ArcCentre.x;
cY = ArcCentre.y;
cY = -cY; /* Attention a l'orientation de l'axe Y */
cY = -cY; /* Attention to the orientation of the axis Y. */
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
/* Calculating cX and cY for the arc passes through ArcStartX, ArcEndX,
* X and Y */
dx = ArcEndX - ArcStartX;
dy = ArcEndY - ArcStartY;
cX -= ArcStartX;
cY -= ArcStartY;
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
/* -> dx = longueur, dy = 0 */
RotatePoint( &dx, &dy, angle ); /* The segment dx, dy is horizontal
* -> Length = dx, dy = 0 */
RotatePoint( &cX, &cY, angle );
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
cX = dx / 2; /* cX, cY is on the median segment 0.0 a dx, 0 */
RotatePoint( &cX, &cY, -angle );
cX += ArcStartX;
......@@ -633,9 +623,9 @@ static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
NORMALIZE_ANGLE( DrawItem->m_t1 );
NORMALIZE_ANGLE( DrawItem->m_t2 ); // angles = 0 .. 3600
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
// son orientation apres rot, miroir...
// Restrict angle to less than 180 to avoid PBS display mirror
// Trace because it is assumed that the arc is less than 180 deg to find
// orientation after rotate or mirror.
if( (DrawItem->m_t2 - DrawItem->m_t1) > 1800 )
DrawItem->m_t2 -= 3600;
else if( (DrawItem->m_t2 - DrawItem->m_t1) <= -1800 )
......
/*************************************************/
/* Functions to Load from file and save to file */
/* the graphic shapes used to draw a component */
/* Functions to Load from file and save to file */
/* the graphic shapes used to draw a component */
/* When using the import/export symbol options */
/* files are the *.sym files */
/*************************************************/
/* fichier symbedit.cpp */
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
......@@ -25,7 +23,7 @@
/*
* Read a component shape file (a symbol file *.sym )and add data (graphic
* Read a component shape file (symbol file *.sym ) and add data (graphic
* items) to the current component.
*
* A symbol file *.sym has the same format as a library, and contains only
......@@ -144,7 +142,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if( m_component->GetDrawItemList().empty() )
return;
/* Creation du fichier symbole */
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
......@@ -176,17 +173,15 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) );
Affiche_Message( msg );
/* Creation de l'entete de la librairie */
char Line[256];
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
"SYMBOL", DateAndTime( Line ) );
/* Creation du commentaire donnant le nom du composant */
/* Component name. */
fprintf( ExportFile, "# SYMBOL %s\n#\n",
CONV_TO_UTF8( m_component->GetName() ) );
/* Generation des lignes utiles */
fprintf( ExportFile, "DEF %s",
CONV_TO_UTF8( m_component->GetName() ) );
if( !m_component->GetReferenceField().m_Text.IsEmpty() )
......@@ -202,7 +197,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
m_component->m_DrawPinName ? 'Y' : 'N',
1, 0 /* unused */, 'N' );
/* Position / orientation / visibilite des champs */
m_component->GetReferenceField().Save( ExportFile );
m_component->GetValueField().Save( ExportFile );
......@@ -229,13 +223,11 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
}
/***************************************************************************/
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
/* le trace) du composant courant */
/* Toutes les coord apparaissant dans les structures sont modifiees */
/* pour repositionner le point repere par le curseur souris au point */
/* d'ancrage ( coord 0,0 ). */
/***************************************************************************/
/*
* Place anchor reference coordinators for current component
*
* All coordinates of the object are offset to the cursor position * /
*/
void WinEDA_LibeditFrame::PlaceAncre()
{
if( m_component == NULL )
......
/********************************************/
/* tool_lib.cpp: construction des toolbars */
/********************************************/
/******************/
/* tool_lib.cpp */
/******************/
#include "fctsys.h"
#include "common.h"
......@@ -154,7 +154,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
wxBitmap( erc_xpm ), _( "Test for duplicate pins and off grid pins" ) );
wxBitmap( erc_xpm ),
_( "Test for duplicate pins and off grid pins" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
......
/*****************************************************/
/* toolsch.cpp; vreate toolbars for schematic frame */
/*****************************************************/
/******************/
/* tool_sch.cpp */
/******************/
#include "fctsys.h"
#include "common.h"
......@@ -15,21 +15,20 @@
#include "eeschema_id.h"
/**************************************************************/
void WinEDA_SchematicFrame::ReCreateHToolbar()
/**************************************************************/
/* Create the main Horizontal Toolbar for the schematic editor
*/
void WinEDA_SchematicFrame::ReCreateHToolbar()
{
if( m_HToolBar != NULL )
return;
wxString msg;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !KICAD_AUIMANAGER
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ),
_( "New schematic project" ) );
......@@ -37,7 +36,8 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
_( "Open schematic project" ) );
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
wxBitmap( save_project_xpm ),
_( "Save schematic project" ) );
m_HToolBar->AddSeparator();
......@@ -48,12 +48,14 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
_( "Library editor" ) );
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, wxBitmap( library_browse_xpm ),
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
wxBitmap( library_browse_xpm ),
_( "Library browser" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, wxBitmap( hierarchy_nav_xpm ),
_( "Schematic hierarchy navigator" ) );
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString,
wxBitmap( hierarchy_nav_xpm ),
_( "Navigate schematic hierarchy" ) );
m_HToolBar->AddSeparator();
......@@ -67,11 +69,15 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
_( "Paste" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr,
HK_UNDO );
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString,
wxBitmap( undo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
msg = AddHotkeyName( _( "Redo the last undo command" ),
s_Schematic_Hokeys_Descr, HK_REDO );
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString,
wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
......@@ -89,15 +95,18 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
msg );
......@@ -109,30 +118,30 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Netlist generation" ) );
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, wxBitmap( annotate_xpm ),
_( "Schematic Annotation" ) );
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString,
wxBitmap( annotate_xpm ),
_( "Annotate schematic" ) );
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ),
_( "Schematic Electric Rules Check" ) );
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ),
_( "Bill of material and/or Crossreferences" ) );
_( "Bill of material and/or Cross references" ) );
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, wxBitmap( backanno_xpm ),
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
wxBitmap( backanno_xpm ),
_( "Backannotate footprint" ) );
// after adding the tools to the toolbar, must call Realize() to reflect the changes
// after adding the tools to the toolbar, must call Realize() to
// reflect the changes
m_HToolBar->Realize();
SetToolbars();
}
/*************************************************/
void WinEDA_SchematicFrame::ReCreateVToolbar()
/*************************************************/
/* Create Vertical Right Toolbar
*/
void WinEDA_SchematicFrame::ReCreateVToolbar()
{
if( m_VToolBar )
return;
......@@ -185,17 +194,17 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString,
wxBitmap( add_glabel_xpm ),
_( "Place a global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ),
wxITEM_CHECK );
wxITEM_CHECK );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
wxBitmap( add_junction_xpm ),
_( "Place a junction" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
wxBitmap( add_hierarchical_label_xpm ),
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
wxBitmap( add_hierarchical_label_xpm ),
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
wxBitmap( add_hierarchical_subsheet_xpm ),
......@@ -203,8 +212,8 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
m_VToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
wxBitmap( import_hierarchical_label_xpm ),
_( "Place a pin sheet , imported from the corresponding hierarchical label in sheet" ),
wxITEM_CHECK );
_( "Place a pin sheet, imported from the corresponding hierarchical label in sheet" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString,
wxBitmap( add_hierar_pin_xpm ),
......@@ -229,22 +238,19 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
}
/****************************************************************/
void WinEDA_SchematicFrame::ReCreateOptToolbar()
/****************************************************************/
/* Create Vertical Left Toolbar (Option Toolbar)
*/
void WinEDA_SchematicFrame::ReCreateOptToolbar()
{
if( m_OptionsToolBar )
return;
// creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
_( "Display Grid OFF" ), wxITEM_CHECK );
_( "Turn grid off" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
wxBitmap( unit_inch_xpm ),
......@@ -256,17 +262,18 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
wxBitmap( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK );
_( "Change cursor shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
wxBitmap( hidden_pin_xpm ),
_( "Show Hidden Pins" ), wxITEM_CHECK );
_( "Show hidden pins" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
wxBitmap( lines90_xpm ),
_( "HV orientation for Wires and Bus" ), wxITEM_CHECK );
_( "HV orientation for wires and bus" ),
wxITEM_CHECK );
m_OptionsToolBar->Realize();
......@@ -274,9 +281,7 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
}
/*******************************************************************************************/
void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
/*******************************************************************************************/
{
if( DrawPanel == NULL )
return;
......@@ -295,13 +300,13 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE;
UpdateStatusBar(); /* Reaffichage des coord curseur */
UpdateStatusBar();
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UnitMetric = INCHES;
UpdateStatusBar(); /* Reaffichage des coord curseur */
UpdateStatusBar();
DrawPanel->Refresh();
break;
......
......@@ -51,19 +51,23 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
_( "Display next part" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_IN );
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_OUT );
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW );
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_AUTO );
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_AUTO );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ), msg );
......@@ -91,12 +95,12 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
_( "View component documents" ) );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( m_Semaphore ) // The lib browser is called from a "load component" command
if( m_Semaphore )
{
// The library browser is called from a "load component" command
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString,
wxBitmap( export_xpm ),
wxEmptyString, wxBitmap( export_xpm ),
_( "Insert component in schematic" ) );
}
......
/*************************************************************************/
/* viewlib_frame.cpp - fonctions des classes du type WinEDA_ViewlibFrame */
/*************************************************************************/
/***********************/
/* viewlib_frame.cpp */
/***********************/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -102,11 +102,12 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
SetBaseScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; // set to true to have the coordinates origine -0,0) centered on screen
GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
// Initialize grid id to a default value if not found in config or bad:
if( ( m_LastGridSizeId <= 0 ) ||
( m_LastGridSizeId < ( ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
......@@ -121,6 +122,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_LibListSize.y = size.y;
wxPoint win_pos( 0, 0 );
#if !KICAD_AUIMANAGER
if( Library == NULL )
{
......@@ -190,6 +192,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
0, NULL, wxLB_HSCROLL );
#endif
if( m_LibList )
ReCreateListLib();
DisplayLibInfos();
......@@ -199,35 +202,35 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
Show( TRUE );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz);
wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT ("m_HToolBar" ) ).Top().Row( 0 ) );
m_auimgr.AddPane(m_LibList,
wxAuiPaneInfo(vert).Name(wxT("m_LibList")).Left().Row(0));
m_auimgr.AddPane( m_LibList,
wxAuiPaneInfo( vert ).Name( wxT( "m_LibList" ) ).Left().Row( 0 ) );
m_auimgr.AddPane(m_CmpList,
wxAuiPaneInfo(vert).Name(wxT("m_CmpList")).Left().Row(1));
m_auimgr.AddPane( m_CmpList,
wxAuiPaneInfo( vert ).Name( wxT( "m_CmpList" ) ).Left().Row( 1 ) );
m_auimgr.AddPane(DrawPanel,
wxAuiPaneInfo(vert).Name(wxT("DrawFrame")).Center());
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo( vert ).Name( wxT( "DrawFrame" ) ).Center() );
m_auimgr.AddPane(MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
......@@ -339,10 +342,12 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
}
#if KICAD_AUIMANAGER
if(m_auimgr.GetManagedWindow())
m_auimgr.Update();
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
#endif
SizeEv.Skip();
}
......@@ -567,7 +572,7 @@ void WinEDA_ViewlibFrame::LoadSettings( )
cfg->Read( LIBLIST_WIDTH_KEY, &m_LibListSize.x );
cfg->Read( CMPLIST_WIDTH_KEY, &m_CmpListSize.x );
// set parameters to a resonnable value
// Set parameters to a reasonable value.
if ( m_LibListSize.x > m_FrameSize.x/2 )
m_LibListSize.x = m_FrameSize.x/2;
......
/***********************************************************/
/* wxEeschemaStruct.h: */
/* descriptions des principales classes derivees utilisees */
/***********************************************************/
#ifndef WX_EESCHEMA_STRUCT_H
......@@ -27,9 +26,9 @@ class DrawBusEntryStruct;
class SCH_GLOBALLABEL;
class SCH_TEXT;
class EDA_DrawLineStruct;
class DrawSheetStruct;
class SCH_SHEET;
class DrawSheetPath;
class Hierarchical_PIN_Sheet_Struct;
class SCH_SHEET_PIN;
class SCH_COMPONENT;
class SCH_CMP_FIELD;
class LIB_PIN;
......@@ -38,19 +37,19 @@ class DrawJunctionStruct;
/* enum used in RotationMiroir() */
enum fl_rot_cmp
{
CMP_NORMAL, // orientation normale (O, pas de miroir)
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
CMP_ORIENT_90, // orientation 90, pas de miroir
CMP_ORIENT_180, // orientation 180, pas de miroir
CMP_ORIENT_270, // orientation -90, pas de miroir
CMP_MIROIR_X = 0x100, // miroir selon axe X
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
CMP_NORMAL, // Normal orientation, no rotation or mirror
CMP_ROTATE_CLOCKWISE, // Rotate -90
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
CMP_ORIENT_90, // Rotate 90, no mirror
CMP_ORIENT_180, // Rotate 180, no mirror
CMP_ORIENT_270, // Rotate -90, no mirror
CMP_MIROIR_X = 0x100, // Mirror around X axis
CMP_MIROIR_Y = 0x200 // Mirror around Y axis
};
/**
* Schemitic editor (EESchema) main window.
* Schematic editor (EESchema) main window.
*/
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
......@@ -131,7 +130,7 @@ public:
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
int BestZoom();
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
......@@ -141,8 +140,8 @@ public:
* Function FillFootprintFieldForAllInstancesofComponent
* searches for component "aReference", and places a Footprint in
* Footprint field
* @param aReference = reference of the component to initialise
* @param aFootPrint = new value for the filed Fottprint component
* @param aReference = reference of the component to initialize
* @param aFootPrint = new value for the filed Footprint component
* @param aSetVisible = true to have the field visible, false to set the
* invisible flag
* @return true if the given component is found
......@@ -181,14 +180,14 @@ public:
// Functions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void InstallNextScreen( SCH_SHEET* Sheet );
/** Function GetUniqueFilenameForCurrentSheet
* @return a filename that can be used in plot and print functions
* for the current screen anad sheet path.
* This filename is unique and must be used insteed of the sreen filename
* (or scheen filename) when one must creates file for each sheet in the
* heierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
* for the current screen and sheet path.
* This filename is unique and must be used instead of the screen filename
* (or screen filename) when one must creates file for each sheet in the
* hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
* used more than once
* Name is <root sheet filename>-<sheet path>
* and has no extension.
......@@ -316,8 +315,8 @@ private:
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
SCH_SHEET* CreateSheet( wxDC* DC );
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
/**
* Use the component viewer to select component to import into schematic.
......@@ -325,7 +324,7 @@ private:
wxString SelectFromLibBrowser( void );
public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
bool EditSheet( SCH_SHEET* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
......@@ -334,20 +333,18 @@ public:
void UpdateSheetNumberAndDate();
private:
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
Hierarchical_PIN_Sheet_Struct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
void Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC );
void StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC );
void Place_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC );
Hierarchical_PIN_Sheet_Struct* Import_PinSheet( DrawSheetStruct* Sheet,
wxDC* DC );
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
SCH_SHEET_PIN* Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
void Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC );
void StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
wxDC* DC );
void Place_PinSheet( SCH_SHEET_PIN* SheetLabel,
wxDC* DC );
SCH_SHEET_PIN* Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
public:
void DeleteSheetLabel( bool aRedraw,
Hierarchical_PIN_Sheet_Struct* aSheetLabelToDel );
SCH_SHEET_PIN* aSheetLabelToDel );
private:
......@@ -376,7 +373,6 @@ private:
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
/* Operations sur bloc */
void PasteListOfItems( wxDC* DC );
/* Undo - redo */
......@@ -410,7 +406,7 @@ private:
/** Function PutDataInPreviousState()
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state
* memorised by List
* memorized by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
* undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo
......@@ -437,17 +433,15 @@ private:
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */
/* Block operations. */
int ReturnBlockCommand( int key );
void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
LIB_PIN* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
......
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