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 // Name: 3d_aux.cpp
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -23,9 +22,8 @@ ...@@ -23,9 +22,8 @@
#include "3d_viewer.h" #include "3d_viewer.h"
#include "trackball.h" #include "trackball.h"
/**************************************************************************/
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord ) void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/**************************************************************************/
{ {
int ii; int ii;
...@@ -39,13 +37,13 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord ) ...@@ -39,13 +37,13 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/* adjust rotation */ /* adjust rotation */
if( m_MatRotation.x ) if( m_MatRotation.x )
RotatePoint( &coord[ii].y, &coord[ii].z, RotatePoint( &coord[ii].y, &coord[ii].z,
(int) (m_MatRotation.x * 10) ); (int) (m_MatRotation.x * 10) );
if( m_MatRotation.y ) if( m_MatRotation.y )
RotatePoint( &coord[ii].z, &coord[ii].x, RotatePoint( &coord[ii].z, &coord[ii].x,
(int) (m_MatRotation.y * 10) ); (int) (m_MatRotation.y * 10) );
if( m_MatRotation.z ) if( m_MatRotation.z )
RotatePoint( &coord[ii].x, &coord[ii].y, 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) */ /* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB) #define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV; coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
...@@ -55,9 +53,7 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord ) ...@@ -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 ) void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
/************************************************************/
{ {
int ii; int ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r; 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 ) ...@@ -106,17 +102,15 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
for( ii = 0; ii < nbcoord; ii++ ) for( ii = 0; ii < nbcoord; ii++ )
{ {
glVertex3f( coord[ii].x * DataScale3D, glVertex3f( coord[ii].x * DataScale3D,
coord[ii].y * DataScale3D, coord[ii].y * DataScale3D,
coord[ii].z * DataScale3D ); coord[ii].z * DataScale3D );
} }
glEnd(); glEnd();
} }
/**********************************************/
GLuint Pcb3D_GLCanvas::DisplayCubeforTest() GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/**********************************************/
{ {
GLuint gllist = glGenLists( 1 ); GLuint gllist = glGenLists( 1 );
...@@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest() ...@@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/* class Info_3D_Visu */ /* class Info_3D_Visu */
/**********************/ /**********************/
/* Constructor */
Info_3D_Visu::Info_3D_Visu() Info_3D_Visu::Info_3D_Visu()
{ {
int ii; int ii;
...@@ -176,8 +169,8 @@ Info_3D_Visu::Info_3D_Visu() ...@@ -176,8 +169,8 @@ Info_3D_Visu::Info_3D_Visu()
m_Draw3DZone = TRUE; m_Draw3DZone = TRUE;
m_Draw3DComments = TRUE; m_Draw3DComments = TRUE;
m_Draw3DDrawings = TRUE; m_Draw3DDrawings = TRUE;
m_Draw3DEco1 = TRUE; m_Draw3DEco1 = TRUE;
m_Draw3DEco2 = TRUE; m_Draw3DEco2 = TRUE;
} }
...@@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu() ...@@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu()
} }
/*****************************************************************/ /* Display and edit a Vertex (triplet of values) in INCHES or MM or without
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/ * units */
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int units, int internal_unit ) int units, int internal_unit )
...@@ -207,73 +197,63 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, ...@@ -207,73 +197,63 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
text = title; text = title;
text += ReturnUnitSymbol( units ); text += ReturnUnitSymbol( units );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize( msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition,
-1, wxSize( -1, -1 ), 0 );
-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 ); BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) ); msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
GridSizer->Add( msgtitle, GridSizer->Add( msgtitle, 0,
0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE, wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 ); 5 );
m_XValueCtrl = new wxTextCtrl( parent, m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
-1, wxDefaultPosition, wxSize( -1, -1 ), 0 );
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( m_XValueCtrl, GridSizer->Add( m_XValueCtrl,
0, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
5 ); wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT( msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
"Y:" ), wxDefaultPosition, wxSize( -1, wxSize( -1, -1 ), 0 );
-1 ), 0 );
GridSizer->Add( msgtitle, GridSizer->Add( msgtitle,
0, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
5 ); wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
m_YValueCtrl = new wxTextCtrl( parent, 5 );
-1, m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxEmptyString, wxDefaultPosition, wxSize( -1, -1 ), 0 );
wxDefaultPosition,
wxSize( -1, -1 ), GridSizer->Add( m_YValueCtrl, 0,
0 ); wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
GridSizer->Add( m_YValueCtrl, 5 );
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
5 ); wxSize( -1, -1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( GridSizer->Add( msgtitle, 0,
"Z:" ), wxDefaultPosition, wxSize( -1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
-1 ), 0 ); wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
GridSizer->Add( msgtitle, m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
0, wxDefaultPosition, wxSize( -1, -1 ), 0 );
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 ); GridSizer->Add( m_ZValueCtrl, 0,
m_ZValueCtrl = new wxTextCtrl( parent, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
-1, wxLEFT | wxRIGHT,
wxEmptyString, 5 );
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() ...@@ -282,12 +262,8 @@ WinEDA_VertexCtrl::~WinEDA_VertexCtrl()
} }
/*******************************************/ /* Returns (in internal units) to coordinate between (in user units) */
S3D_Vertex WinEDA_VertexCtrl::GetValue() S3D_Vertex WinEDA_VertexCtrl::GetValue()
/*******************************************/
/* Retourne (en unites internes) les coordonnes entrees (en unites utilisateur)
*/
{ {
S3D_Vertex value; S3D_Vertex value;
double dtmp; double dtmp;
...@@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue() ...@@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue()
} }
/**************************************************/
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex ) void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
/**************************************************/
{ {
wxString text; wxString text;
...@@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex ) ...@@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
} }
/*****************************************/
void WinEDA_VertexCtrl::Enable( bool onoff ) void WinEDA_VertexCtrl::Enable( bool onoff )
/*****************************************/
{ {
m_XValueCtrl->Enable( onoff ); m_XValueCtrl->Enable( onoff );
m_YValueCtrl->Enable( onoff ); m_YValueCtrl->Enable( onoff );
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp // Name: 3d_class.cpp
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -14,37 +13,31 @@ ...@@ -14,37 +13,31 @@
#include "3d_viewer.h" #include "3d_viewer.h"
/****************************/
S3D_Vertex::S3D_Vertex() S3D_Vertex::S3D_Vertex()
/****************************/
{ {
x = y = z = 0.0; x = y = z = 0.0;
} }
/**************************************************************************/
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) : S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED ) EDA_BaseStruct( father, NOT_USED )
/**************************************************************************/
{ {
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0; m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0; m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
m_AmbientIntensity = 1.0; m_AmbientIntensity = 1.0;
m_Transparency = 0.0; m_Transparency = 0.0;
m_Shininess = 1.0; m_Shininess = 1.0;
m_Name = name; m_Name = name;
} }
/***********************************/
void S3D_MATERIAL::SetMaterial() void S3D_MATERIAL::SetMaterial()
/***********************************/
{ {
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f( m_DiffuseColor.x * m_AmbientIntensity, glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
m_DiffuseColor.y * m_AmbientIntensity, m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity, m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency ); 1.0 - m_Transparency );
#if 0 #if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR ); glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z ); glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
...@@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial() ...@@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial()
} }
/****************************************************/
void S3D_MASTER::Copy( S3D_MASTER* pattern ) void S3D_MASTER::Copy( S3D_MASTER* pattern )
/****************************************************/
{ {
m_Shape3DName = pattern->m_Shape3DName; m_Shape3DName = pattern->m_Shape3DName;
m_MatScale = pattern->m_MatScale; m_MatScale = pattern->m_MatScale;
...@@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern ) ...@@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
} }
/***************************************************************/
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) : S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED ) EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{ {
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL; m_3D_Drawings = NULL;
...@@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) : ...@@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
} }
/***************************************/
S3D_MASTER:: ~S3D_MASTER() S3D_MASTER:: ~S3D_MASTER()
/***************************************/
{ {
Struct3D_Shape* next; Struct3D_Shape* next;
S3D_MATERIAL* nextmat; S3D_MATERIAL* nextmat;
...@@ -90,7 +77,7 @@ S3D_MASTER:: ~S3D_MASTER() ...@@ -90,7 +77,7 @@ S3D_MASTER:: ~S3D_MASTER()
delete m_3D_Drawings; delete m_3D_Drawings;
} }
for( ; m_Materials != NULL; m_Materials = nextmat ) for( ; m_Materials != NULL; m_Materials = nextmat )
{ {
nextmat = m_Materials->Next(); nextmat = m_Materials->Next();
delete m_Materials; delete m_Materials;
...@@ -98,20 +85,16 @@ S3D_MASTER:: ~S3D_MASTER() ...@@ -98,20 +85,16 @@ S3D_MASTER:: ~S3D_MASTER()
} }
/***************************************************************/
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) : Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED ) EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{ {
m_3D_Coord = NULL; m_3D_Coord = NULL;
m_3D_CoordIndex = NULL; m_3D_CoordIndex = NULL;
m_3D_Points = 0; m_3D_Points = 0;
} }
/***************************************/
Struct3D_Shape:: ~Struct3D_Shape() Struct3D_Shape:: ~Struct3D_Shape()
/***************************************/
{ {
delete m_3D_Coord; delete m_3D_Coord;
delete m_3D_CoordIndex; delete m_3D_CoordIndex;
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: 3d_frame.cpp // Name: 3d_frame.cpp
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -26,11 +25,11 @@ ...@@ -26,11 +25,11 @@
#include <wxstruct.h> #include <wxstruct.h>
Info_3D_Visu g_Parm_3D_Visu; Info_3D_Visu g_Parm_3D_Visu;
double g_Draw3d_dx; double g_Draw3d_dx;
double g_Draw3d_dy; double g_Draw3d_dy;
double ZBottom; double ZBottom;
double ZTop; double ZTop;
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D double DataScale3D; // 3D conversion units.
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
...@@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame ) ...@@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow ) EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE() END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
const wxString& title, const wxString& title,
long style ) : long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title, wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ),
wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) wxSize( -1, -1 ), style )
/*******************************************************************/
{ {
m_FrameName = wxT( "Frame3D" ); m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL; m_Canvas = NULL;
m_Parent = parent; m_Parent = parent;
m_HToolBar = NULL; m_HToolBar = NULL;
m_VToolBar = NULL; m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch m_InternalUnits = 10000; // Internal units = 1/10000 inch
// Give it an icon // Give it an icon
SetIcon( wxICON( icon_w3d ) ); SetIcon( wxICON( icon_w3d ) );
...@@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, ...@@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
// Make a Pcb3D_GLCanvas // Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas( this ); m_Canvas = new Pcb3D_GLCanvas( this );
#if KICAD_AUIMANAGER #if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this); m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz; wxAuiPaneInfo horiz;
horiz.Gripper(false); horiz.Gripper( false );
horiz.DockFixed(true); horiz.DockFixed( true );
horiz.Movable(false); horiz.Movable( false );
horiz.Floatable(false); horiz.Floatable( false );
horiz.CloseButton(false); horiz.CloseButton( false );
horiz.CaptionVisible(false); horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz); wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable(false).RightDockable(false); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane(m_Canvas, m_auimgr.AddPane( m_Canvas,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
} }
/***********************************************************/
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event ) void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
/***********************************************************/
{ {
Close( TRUE ); Close( TRUE );
} }
/***********************************************************/
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/
{ {
SaveSettings(); SaveSettings();
if( m_Parent ) if( m_Parent )
...@@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
} }
/******************************************/
void WinEDA3D_DrawFrame::GetSettings() void WinEDA3D_DrawFrame::GetSettings()
/******************************************/
{ {
wxString text; 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 ) if( config )
{ {
...@@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings() ...@@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings()
} }
/*******************************************/
void WinEDA3D_DrawFrame::SaveSettings() void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/
{ {
wxString text; 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 ) if( !Config )
return; return;
...@@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings() ...@@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
} }
/***********************************************************/
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event ) void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
/***********************************************************/
{ {
int ii; int ii;
...@@ -231,40 +221,29 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event ) ...@@ -231,40 +221,29 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
} }
/************************************************************************/
void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/
{ {
} }
/*******************************************************************************/ void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) wxMenu* PopMenu )
/*******************************************************************************/
{ {
} }
/************************************/
int WinEDA3D_DrawFrame::BestZoom() int WinEDA3D_DrawFrame::BestZoom()
/************************************/
// Retourne le meilleur zoom
{ {
return 1; return 1;
} }
/*******************************************************************/
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
{ {
} }
/************************************************************************/
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
/************************************************************************/
{ {
#define ROT_ANGLE 10.0 #define ROT_ANGLE 10.0
...@@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
return; return;
default: default:
wxMessageBox( wxMessageBox( wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() \
wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) ); error: unknown command" ) );
return; return;
} }
...@@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
} }
/*****************************************/
void WinEDA3D_DrawFrame::NewDisplay() void WinEDA3D_DrawFrame::NewDisplay()
/*****************************************/
{ {
m_Canvas->ClearLists(); m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List(); m_Canvas->CreateDrawGL_List();
// m_Canvas->InitGL(); // m_Canvas->InitGL();
m_Canvas->Refresh( true ); m_Canvas->Refresh( true );
m_Canvas->DisplayStatus(); m_Canvas->DisplayStatus();
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DBgColor()
/******************************************/
/* called to set the background color of the 3D scene /* called to set the background color of the 3D scene
*/ */
void WinEDA3D_DrawFrame::Set3DBgColor()
{ {
S3D_Color color; S3D_Color color;
wxColour newcolor, oldcolor; wxColour newcolor, oldcolor;
...@@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor() ...@@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DAxisOnOff() void WinEDA3D_DrawFrame::Set3DAxisOnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DAxis ) if( g_Parm_3D_Visu.m_Draw3DAxis )
g_Parm_3D_Visu.m_Draw3DAxis = FALSE; g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
...@@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff() ...@@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DModuleOnOff() void WinEDA3D_DrawFrame::Set3DModuleOnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DModule ) if( g_Parm_3D_Visu.m_Draw3DModule )
g_Parm_3D_Visu.m_Draw3DModule = FALSE; g_Parm_3D_Visu.m_Draw3DModule = FALSE;
...@@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff() ...@@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DZoneOnOff() void WinEDA3D_DrawFrame::Set3DZoneOnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DZone ) if( g_Parm_3D_Visu.m_Draw3DZone )
g_Parm_3D_Visu.m_Draw3DZone = FALSE; g_Parm_3D_Visu.m_Draw3DZone = FALSE;
...@@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff() ...@@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DCommentsOnOff() void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DComments ) if( g_Parm_3D_Visu.m_Draw3DComments )
g_Parm_3D_Visu.m_Draw3DComments = FALSE; g_Parm_3D_Visu.m_Draw3DComments = FALSE;
...@@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff() ...@@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff() void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DDrawings ) if( g_Parm_3D_Visu.m_Draw3DDrawings )
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE; g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
...@@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff() ...@@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco1OnOff() void WinEDA3D_DrawFrame::Set3DEco1OnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DEco1 ) if( g_Parm_3D_Visu.m_Draw3DEco1 )
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE; g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
...@@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff() ...@@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff()
} }
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco2OnOff() void WinEDA3D_DrawFrame::Set3DEco2OnOff()
/******************************************/
{ {
if( g_Parm_3D_Visu.m_Draw3DEco2 ) if( g_Parm_3D_Visu.m_Draw3DEco2 )
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE; g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: 3d_read_mesh.cpp // Name: 3d_read_mesh.cpp
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -18,9 +17,7 @@ ...@@ -18,9 +17,7 @@
#include "3d_viewer.h" #include "3d_viewer.h"
/***********************************/ int S3D_MASTER::ReadData()
int S3D_MASTER:: ReadData()
/************************************/
{ {
char line[1024], * text; char line[1024], * text;
wxFileName fn; wxFileName fn;
...@@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData() ...@@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData()
} }
if( wxFileName::FileExists(m_Shape3DName) ) if( wxFileName::FileExists( m_Shape3DName ) )
FullFilename = m_Shape3DName; FullFilename = m_Shape3DName;
else else
{ {
...@@ -44,7 +41,7 @@ int S3D_MASTER:: ReadData() ...@@ -44,7 +41,7 @@ int S3D_MASTER:: ReadData()
if( FullFilename.IsEmpty() ) if( FullFilename.IsEmpty() )
{ {
wxLogDebug( _( "3D part library <%s> could not be found." ), wxLogDebug( _( "3D part library <%s> could not be found." ),
GetChars( fn.GetFullPath() ) ); GetChars( fn.GetFullPath() ) );
return -1; return -1;
} }
} }
...@@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData() ...@@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData()
return -1; return -1;
} }
// Switch the locale to standard C (needed to print floating point numbers like 1.3) // Switch the locale to standard C (needed to print floating point
SetLocaleTo_C_standard( ); // numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
...@@ -79,40 +77,36 @@ int S3D_MASTER:: ReadData() ...@@ -79,40 +77,36 @@ int S3D_MASTER:: ReadData()
} }
fclose( file ); fclose( file );
SetLocaleTo_Default( ); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
return 0; return 0;
} }
/*********************************************************/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
/*********************************************************/
/* /*
* analyse la description du type: * Analyzes the description of the type:
* material DEF yellow Material { * DEF yellow material Material (
* diffuseColor 1.00000 1.00000 0.00000e+0 * DiffuseColor 1.00000 1.00000 0.00000e 0
* emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0 * EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* specularColor 1.00000 1.00000 1.00000 * SpecularColor 1.00000 1.00000 1.00000
* ambientIntensity 1.00000 * AmbientIntensity 1.00000
* transparency 0.00000e+0 * Transparency 0.00000e 0
* shininess 1.00000 * Shininess 1.00000
* } *)
* ou du type: * Or type:
* material USE yellow * USE yellow material
*/ */
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
{ {
char line[512], * text, * command; char line[512], * text, * command;
wxString mat_name; wxString mat_name;
S3D_MATERIAL* material = NULL; S3D_MATERIAL* material = NULL;
// Lecture de la commande:
command = strtok( NULL, " \t\n\r" ); command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, " \t\n\r" );
mat_name = CONV_FROM_UTF8( text ); mat_name = CONV_FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 ) 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 ) if( material->m_Name == mat_name )
{ {
...@@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
} }
/**********************************************************/
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
/***********************************************************/
{ {
char line[1024], * text; char line[1024], * text;
...@@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) ...@@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
} }
/********************************************************/
int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
/********************************************************/
{ {
char line[1024], * text; char line[1024], * text;
int err = 1; int err = 1;
...@@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) ...@@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
} }
/*************************************************************/
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
/*************************************************************/
{ {
char line[1024], * text; char line[1024], * text;
int err = 1; int err = 1;
...@@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) ...@@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
#define BUFSIZE 2000 #define BUFSIZE 2000
/************************************************************************************/ /* Read a coordinate list like:
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
/************************************************************************************/
/* Read a coordinate liste like:
* coord Coordinate { point [ * coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2, * -5.24489 6.57640e-3 -9.42129e-2,
* -5.11821 6.57421e-3 0.542654, * -5.11821 6.57421e-3 0.542654,
...@@ -305,6 +289,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu ...@@ -305,6 +289,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
* text_buffer contains the first line of this node : * text_buffer contains the first line of this node :
* "coord Coordinate { point [" * "coord Coordinate { point ["
*/ */
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
int* LineNum )
{ {
double* data_list = NULL; double* data_list = NULL;
unsigned int ii = 0, jj = 0, nn = BUFSIZE; unsigned int ii = 0, jj = 0, nn = BUFSIZE;
...@@ -351,7 +337,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu ...@@ -351,7 +337,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
if( ii >= nn ) if( ii >= nn )
{ {
nn *= 2; nn *= 2;
data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) ); data_list =
(double*) realloc( data_list, ( nn * sizeof(double) ) );
} }
HasData = FALSE; HasData = FALSE;
if( *text == ']' ) if( *text == ']' )
...@@ -384,9 +371,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu ...@@ -384,9 +371,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
} }
/***********************************************************/
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
/***********************************************************/
{ {
char line[1024], buffer[1024], * text; char line[1024], buffer[1024], * text;
int err = 1; int err = 1;
...@@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normal" ) == 0 ) if( stricmp( text, "normal" ) == 0 )
{ {
int coord_number; int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum ); double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue; continue;
free( buf_points ); free( buf_points );
continue; continue;
...@@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "color" ) == 0 ) if( stricmp( text, "color" ) == 0 )
{ {
int coord_number; int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum ); double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue; continue;
free( buf_points ); free( buf_points );
continue; continue;
...@@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
} }
/*********************************************************/
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum ) int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
/*********************************************************/
{ {
char line[512]; char line[512];
......
/********************************************************/ /*****************/
/* 3d_struct.h : definition des structures de donnees */ /* 3d_struct.h */
/* pour la representation 3D des modules */ /*****************/
/********************************************************/
#ifndef STRUCT_3D_H #ifndef STRUCT_3D_H
#define STRUCT_3D_H #define STRUCT_3D_H
#include "base_struct.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 #define UNITS3D_TO_UNITSPCB 1000
class S3D_MASTER; class S3D_MASTER;
class Struct3D_Shape; 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: public:
double m_Red, m_Green, m_Blue; double m_Red, m_Green, m_Blue;
public: public: S3D_Color()
S3D_Color() { {
m_Red = m_Green = m_Blue = 0; 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: public:
double x, y, z; double x, y, z;
public: public: S3D_Vertex();
S3D_Vertex();
}; };
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/ class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
...@@ -45,8 +45,7 @@ public: ...@@ -45,8 +45,7 @@ public:
float m_Transparency; float m_Transparency;
float m_Shininess; float m_Shininess;
public: public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
S3D_MATERIAL( S3D_MASTER * father, const wxString &name );
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; } S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; } S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
...@@ -55,10 +54,8 @@ public: ...@@ -55,10 +54,8 @@ public:
}; };
/*******************************************/
class S3D_MASTER : public EDA_BaseStruct
/*******************************************/
/* Master structure for a 3D item description */ /* Master structure for a 3D item description */
class S3D_MASTER : public EDA_BaseStruct
{ {
public: public:
wxString m_Shape3DName; /* 3D shape name in 3D library */ wxString m_Shape3DName; /* 3D shape name in 3D library */
...@@ -68,9 +65,7 @@ public: ...@@ -68,9 +65,7 @@ public:
Struct3D_Shape* m_3D_Drawings; Struct3D_Shape* m_3D_Drawings;
S3D_MATERIAL* m_Materials; S3D_MATERIAL* m_Materials;
public: public: S3D_MASTER( EDA_BaseStruct* aParent );
S3D_MASTER( EDA_BaseStruct * aParent );
~S3D_MASTER(); ~S3D_MASTER();
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; } S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
...@@ -82,30 +77,27 @@ public: ...@@ -82,30 +77,27 @@ public:
m_Materials = aMaterial; m_Materials = aMaterial;
} }
void Copy( S3D_MASTER* pattern );
int ReadData(); void Copy( S3D_MASTER* pattern );
int ReadMaterial( FILE* file, int* LineNum ); int ReadData();
int ReadChildren( FILE* file, int* LineNum ); int ReadMaterial( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum ); int ReadChildren( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum ); int ReadShape( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum ); int ReadAppearance( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord ); 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 class Struct3D_Shape : public EDA_BaseStruct
/*********************************************/
/* decrit une forme complexe 3D */
{ {
public: public:
S3D_Vertex* m_3D_Coord; S3D_Vertex* m_3D_Coord;
int* m_3D_CoordIndex; int* m_3D_CoordIndex;
int m_3D_Points; int m_3D_Points;
public: public: Struct3D_Shape( EDA_BaseStruct* aParent );
Struct3D_Shape( EDA_BaseStruct * aParent );
~Struct3D_Shape(); ~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; } Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
...@@ -115,14 +107,11 @@ public: ...@@ -115,14 +107,11 @@ public:
}; };
/*****************************************************************/ /* Display and edit a Vertex (triplet of values) in INCHES or MM or without
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/ * units.
/* en INCHES ou MM ou sans unites */ * internal_unit is the internal unit number by inch:
/*****************************************************************/ * - 1000 for EESchema
* - 10000 for PcbNew
/* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
*/ */
class WinEDA_VertexCtrl class WinEDA_VertexCtrl
{ {
...@@ -133,18 +122,15 @@ private: ...@@ -133,18 +122,15 @@ private:
wxStaticText* m_Text; wxStaticText* m_Text;
public: public:
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
// Constructor and destructor wxBoxSizer* BoxSizer, int units, int internal_unit );
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
wxBoxSizer * BoxSizer,
int units, int internal_unit );
~WinEDA_VertexCtrl(); ~WinEDA_VertexCtrl();
S3D_Vertex GetValue(); S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex ); void SetValue( S3D_Vertex vertex );
void Enable( bool enbl ); void Enable( bool enbl );
void SetToolTip( const wxString& text ); void SetToolTip( const wxString& text );
}; };
......
/*******************************************************************/ /********************/
/* 3d_toolbar.cpp: construction des tool bars de la frame visu 3d */ /* 3d_toolbar.cpp */
/*******************************************************************/ /********************/
#include "fctsys.h" #include "fctsys.h"
#include "macros.h" #include "macros.h"
...@@ -9,31 +9,34 @@ ...@@ -9,31 +9,34 @@
#include "3d_viewer.h" #include "3d_viewer.h"
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateHToolbar() void WinEDA3D_DrawFrame::ReCreateHToolbar()
/*********************************************/
{ {
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens {
// Simple update to the list of old files.
SetToolbars(); SetToolbars();
return; return;
} }
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !KICAD_AUIMANAGER #if !KICAD_AUIMANAGER
SetToolBar( (wxToolBar*)m_HToolBar ); SetToolBar( (wxToolBar*) m_HToolBar );
#endif #endif
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
wxBitmap( import3d_xpm ), wxBitmap( import3d_xpm ),
_( "Reload board" ) ); _( "Reload board" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__)) // do not work properly under linux #if (defined(__WINDOWS__) || defined(__APPLE__ ) )
m_HToolBar-> AddSeparator();
// Does not work properly under linux
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString, m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
wxBitmap( copy_button ), wxBitmap( copy_button ),
_( "Copy 3D Image to Clipboard" ) ); _( "Copy 3D Image to Clipboard" ) );
#endif #endif
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar() ...@@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
_( "Move right ->" ) ); _( "Move right ->" ) );
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ), m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
_( "Move Up ^" ) ); _( "Move up ^" ) );
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ), m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
_( "Move Down" ) ); _( "Move down" ) );
m_HToolBar->Realize(); m_HToolBar->Realize();
// SetToolbars();
} }
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateVToolbar() void WinEDA3D_DrawFrame::ReCreateVToolbar()
/*********************************************/
{ {
} }
/**********************************************/
void WinEDA3D_DrawFrame::ReCreateMenuBar() 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 called from the display frame of cvpcb, only some options are
if ( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb ! // relevant
full_options = false; // Do not display all options if( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all
// options
wxMenuBar* menuBar = new wxMenuBar; wxMenuBar* menuBar = new wxMenuBar;
...@@ -119,8 +118,10 @@ bool full_options = true; ...@@ -119,8 +118,10 @@ bool full_options = true;
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) ); fileMenu->Append( ID_MENU_SCREENCOPY_PNG,
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) ); _( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ) );
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) ); fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
...@@ -133,33 +134,31 @@ bool full_options = true; ...@@ -133,33 +134,31 @@ bool full_options = true;
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), axis3d_front_xpm ); _( "3D Axis On/Off" ), axis3d_front_xpm );
if ( full_options ) if( full_options )
{ {
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm ); _( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), add_zone_xpm ); _( "Zone Filling On/Off" ), add_zone_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), edit_sheet_xpm ); _( "Comments Layer On/Off" ), edit_sheet_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), add_polygon_xpm ); _( "Drawings Layer On/Off" ), add_polygon_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), tools_xpm ); _( "Eco1 Layer On/Off" ), tools_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF, ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), tools_xpm ); _( "Eco2 Layer On/Off" ), tools_xpm );
} }
SetMenuBar( menuBar ); SetMenuBar( menuBar );
} }
/*****************************************/
void WinEDA3D_DrawFrame::SetToolbars() void WinEDA3D_DrawFrame::SetToolbars()
/*****************************************/
{ {
} }
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#include "id.h" #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. * Command IDs for the 3D viewer.
...@@ -100,104 +100,106 @@ class SEGVIA; ...@@ -100,104 +100,106 @@ class SEGVIA;
class Info_3D_Visu class Info_3D_Visu
{ {
public: public:
double m_Beginx, m_Beginy; /* position of mouse */ double m_Beginx, m_Beginy; /* position of mouse */
double m_Quat[4]; /* orientation of object */ double m_Quat[4]; /* orientation of object */
double m_Rot[4]; /* man rotation of object */ double m_Rot[4]; /* man rotation of object */
double m_Zoom; /* field of view in degrees */ double m_Zoom; /* field of view in degrees */
S3D_Color m_BgColor; S3D_Color m_BgColor;
bool m_Draw3DAxis; bool m_Draw3DAxis;
bool m_Draw3DModule; bool m_Draw3DModule;
bool m_Draw3DZone; bool m_Draw3DZone;
bool m_Draw3DComments; bool m_Draw3DComments;
bool m_Draw3DDrawings; bool m_Draw3DDrawings;
bool m_Draw3DEco1; bool m_Draw3DEco1;
bool m_Draw3DEco2; bool m_Draw3DEco2;
wxPoint m_BoardPos; wxPoint m_BoardPos;
wxSize m_BoardSize; wxSize m_BoardSize;
int m_Layers; int m_Layers;
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design
double m_Epoxy_Width; /* Epoxy tickness (normalized) */ // settings
double m_Epoxy_Width; /* Epoxy thickness (normalized)
double m_BoardScale; /* Normalisation scale for coordinates: **/
when scaled tey are between -1.0 and +1.0 */
double m_LayerZcoord[32]; double m_BoardScale; /* Normalization scale for coordinates:
public: * when scaled between -1.0 and +1.0 */
Info_3D_Visu(); double m_LayerZcoord[32];
public: Info_3D_Visu();
~Info_3D_Visu(); ~Info_3D_Visu();
}; };
class Pcb3D_GLCanvas: public wxGLCanvas class Pcb3D_GLCanvas : public wxGLCanvas
{ {
public: public:
WinEDA3D_DrawFrame * m_Parent; WinEDA3D_DrawFrame* m_Parent;
private: private:
bool m_init; bool m_init;
GLuint m_gllist; GLuint m_gllist;
#if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 )
wxGLContext* m_glRC; wxGLContext* m_glRC;
#endif #endif
public: public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent ); Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
~Pcb3D_GLCanvas(); ~Pcb3D_GLCanvas();
void ClearLists(); void ClearLists();
void OnPaint(wxPaintEvent& event); void OnPaint( wxPaintEvent& event );
void OnEraseBackground(wxEraseEvent& event); void OnEraseBackground( wxEraseEvent& event );
void OnChar(wxKeyEvent& event); void OnChar( wxKeyEvent& event );
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent( wxMouseEvent& event );
void OnRightClick(wxMouseEvent& event); void OnRightClick( wxMouseEvent& event );
void OnPopUpMenu(wxCommandEvent & event); void OnPopUpMenu( wxCommandEvent& event );
void TakeScreenshot(wxCommandEvent & event); void TakeScreenshot( wxCommandEvent& event );
void SetView3D(int keycode); void SetView3D( int keycode );
void DisplayStatus(); void DisplayStatus();
void Redraw(bool finish = false); void Redraw( bool finish = false );
GLuint DisplayCubeforTest(); GLuint DisplayCubeforTest();
void OnEnterWindow( wxMouseEvent& event ); void OnEnterWindow( wxMouseEvent& event );
void Render(); void Render();
GLuint CreateDrawGL_List(); GLuint CreateDrawGL_List();
void InitGL(); void InitGL();
void SetLights(); void SetLights();
void Draw3D_Track(TRACK * track); void Draw3D_Track( TRACK* track );
void Draw3D_Via(SEGVIA * via); void Draw3D_Via( SEGVIA* via );
void Draw3D_DrawSegment(DRAWSEGMENT * segment); void Draw3D_DrawSegment( DRAWSEGMENT* segment );
void Draw3D_DrawText(TEXTE_PCB * text); void Draw3D_DrawText( TEXTE_PCB* text );
//int Get3DLayerEnable(int act_layer); //int Get3DLayerEnable(int act_layer);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
class WinEDA3D_DrawFrame: public wxFrame class WinEDA3D_DrawFrame : public wxFrame
{ {
public: public:
WinEDA_BasePcbFrame * m_Parent; WinEDA_BasePcbFrame* m_Parent;
Pcb3D_GLCanvas * m_Canvas; Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar * m_HToolBar; WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar * m_VToolBar; WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits; int m_InternalUnits;
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;
#if KICAD_AUIMANAGER #if KICAD_AUIMANAGER
wxAuiManager m_auimgr; wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); }; ~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif #endif
private: private:
wxString m_FrameName; // name used for writting and reading setup wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D" // It is "Frame3D"
public: public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent, WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event); void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow(wxCloseEvent & Event); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateMenuBar(); void ReCreateMenuBar();
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
...@@ -205,13 +207,13 @@ public: ...@@ -205,13 +207,13 @@ public:
void GetSettings(); void GetSettings();
void SaveSettings(); void SaveSettings();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnKeyEvent(wxKeyEvent& event); void OnKeyEvent( wxKeyEvent& event );
int BestZoom(); // Retourne le meilleur zoom int BestZoom();
void RedrawActiveWindow(wxDC * DC, bool EraseBg); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions(wxCommandEvent& event); void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom(wxCommandEvent& event); void Process_Zoom( wxCommandEvent& event );
void NewDisplay(); void NewDisplay();
void Set3DBgColor(); void Set3DBgColor();
...@@ -227,13 +229,13 @@ public: ...@@ -227,13 +229,13 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
void SetGLColor(int color); void SetGLColor( int color );
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord ); void Set_Object_Data( const S3D_Vertex* coord, int nbcoord );
extern Info_3D_Visu g_Parm_3D_Visu; extern Info_3D_Visu g_Parm_3D_Visu;
extern double g_Draw3d_dx, g_Draw3d_dy; extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop; extern double ZBottom, ZTop;
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D extern double DataScale3D; // 3D scale units.
extern int gl_attrib[]; extern int gl_attrib[];
#endif /* __3D_VIEWER_H__ */ #endif /* __3D_VIEWER_H__ */
...@@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
// Add all pins sheets of a selected hierarchical sheet to the list // Add all pins sheets of a selected hierarchical sheet to the list
Hierarchical_PIN_Sheet_Struct* SLabel = SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
( (DrawSheetStruct*) Struct )->m_Label;
while( SLabel ) while( SLabel )
{ {
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
AddPickedItem( screen, SLabel->m_Pos ); 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 ) ...@@ -300,7 +300,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
/* Fill aList with Glabel info /* Fill aList with Glabel info
*/ */
SCH_ITEM* DrawList; SCH_ITEM* DrawList;
Hierarchical_PIN_Sheet_Struct* PinLabel; SCH_SHEET_PIN* PinLabel;
DrawSheetPath* sheet; DrawSheetPath* sheet;
/* Build the sheet list */ /* Build the sheet list */
...@@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList ) ...@@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label; PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
while( PinLabel != NULL ) while( PinLabel != NULL )
{ {
labet_object.m_LabelType = labet_object.m_LabelType =
...@@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) ...@@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
wxString* Text1, * Text2; wxString* Text1, * Text2;
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) 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 else
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text; Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) 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 else
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text; Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
...@@ -464,12 +464,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 ) ...@@ -464,12 +464,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
if( ii == 0 ) if( ii == 0 )
{ {
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) 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 else
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text; Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) 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 else
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text; Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
...@@ -804,7 +804,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -804,7 +804,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
{ {
/************************************************************************/ /************************************************************************/
SCH_LABEL* DrawTextItem; SCH_LABEL* DrawTextItem;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel; SCH_SHEET_PIN* DrawSheetLabel;
wxString msg, sheetpath; wxString msg, sheetpath;
wxString labeltype; wxString labeltype;
...@@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
{ {
DrawSheetLabel = DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
int jj = DrawSheetLabel->m_Shape; int jj = DrawSheetLabel->m_Shape;
if( jj < 0 ) if( jj < 0 )
jj = NET_TMAX; jj = NET_TMAX;
......
...@@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
EDA_BaseStruct* item; EDA_BaseStruct* item;
LIB_PIN* pin; LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet; SCH_SHEET_PIN* pinsheet;
wxPoint itempos; wxPoint itempos;
switch( layer ) switch( layer )
......
This diff is collapsed.
...@@ -7,17 +7,19 @@ ...@@ -7,17 +7,19 @@
#include "base_struct.h" #include "base_struct.h"
extern DrawSheetStruct* g_RootSheet; extern SCH_SHEET* g_RootSheet;
/* class Hierarchical_PIN_Sheet_Struct /**
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for * Pin (label) used in sheets to create hierarchical schematics.
* a component *
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire, * A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* bus or label * pin is used in a component. It connects the ojects in the sheet object
* A sheet level it corresponds to a hierarchical label. * 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, class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
public EDA_TextStruct
{ {
public: public:
int m_Edge, m_Shape; int m_Edge, m_Shape;
...@@ -26,23 +28,23 @@ public: ...@@ -26,23 +28,23 @@ public:
// m_Number >= 2 // m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename // value 0 is for sheet name and 1 for sheet filename
public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent, public: SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { } ~SCH_SHEET_PIN() { }
virtual wxString GetClass() const 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, void Place( WinEDA_SchematicFrame* frame,
...@@ -108,12 +110,12 @@ public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent, ...@@ -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 * This class is the sheet symbol placed in a schematic, and is the entry point
* for a sub schematic * for a sub schematic
*/ */
class DrawSheetStruct : public SCH_ITEM class SCH_SHEET : public SCH_ITEM
{ {
public: public:
wxString m_SheetName; /* this is equivalent to C101 for wxString m_SheetName; /* this is equivalent to C101 for
...@@ -132,22 +134,23 @@ public: ...@@ -132,22 +134,23 @@ public:
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of *sheet symbol */ wxSize m_Size; /* Position and Size of *sheet symbol */
int m_Layer; int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
* list.*/ * list.*/
int m_NbLabel; /* Pins sheet (corresponding to int m_NbLabel; /* Pins sheet (corresponding to
* hierarchical labels) count */ * hierarchical labels) count */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
* handle the physical data * handle the physical data
* In complex hierarchies we * In complex hierarchies we
* can have many DrawSheetStruct * can have many SCH_SHEET
* using the same data * using the same data
*/ */
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); public:
~DrawSheetStruct(); SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_SHEET();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "DrawSheetStruct" ); return wxT( "SCH_SHEET" );
} }
...@@ -158,23 +161,23 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -158,23 +161,23 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy(); SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function CleanupSheet /** Function CleanupSheet
* Delete pinsheets which are not corresponding to a hierarchical label * Delete pinsheets which are not corresponding to a hierarchical label
* @param aRedraw = true to redraw Sheet * @param aRedraw = true to redraw Sheet
* @param aFrame = the schematic frame * @param aFrame = the schematic frame
*/ */
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw ); void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize(); virtual int GetPenSize();
/** Function Draw /** Function Draw
* Draw the hierarchical sheet shape * Draw the hierarchical sheet shape
...@@ -185,11 +188,11 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -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 * @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items * color for sheet items
*/ */
void Draw( WinEDA_DrawPanel* aPanel, void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aDrawMode, int aDrawMode,
int aColor = -1 ); int aColor = -1 );
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
...@@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem ); void SwapData( SCH_SHEET* copyitem );
/** Function ComponentCount /** Function ComponentCount
* count our own components, without the power components. * count our own components, without the power components.
...@@ -277,7 +280,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -277,7 +280,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
bool ChangeFileName( WinEDA_SchematicFrame* aFrame, bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName ); const wxString& aFileName );
//void RemoveSheet(DrawSheetStruct* sheet); //void RemoveSheet(SCH_SHEET* sheet);
//to remove a sheet, just delete it //to remove a sheet, just delete it
//-- the destructor should take care of everything else. //-- the destructor should take care of everything else.
...@@ -290,7 +293,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -290,7 +293,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
Hierarchical_PIN_Sheet_Struct* label = m_Label; SCH_SHEET_PIN* label = m_Label;
while( label != NULL ) while( label != NULL )
{ {
label->Move( aMoveVector ); label->Move( aMoveVector );
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp // Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct // Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h // header = class_drawsheet.h
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
...@@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue( ...@@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
{ {
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem; SCH_SHEET* sheet = (SCH_SHEET*) schitem;
Push( sheet ); Push( sheet );
if( aPath == Path() ) if( aPath == Path() )
return true; return true;
...@@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const ...@@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
* returns a pointer to the last sheet of the list * returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet * One can see the others sheet as the "path" to reach this last sheet
*/ */
DrawSheetStruct* DrawSheetPath::Last() SCH_SHEET* DrawSheetPath::Last()
{ {
if( m_numSheets ) if( m_numSheets )
return m_sheets[m_numSheets - 1]; return m_sheets[m_numSheets - 1];
...@@ -134,12 +134,12 @@ SCH_ITEM* DrawSheetPath::LastDrawList() ...@@ -134,12 +134,12 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
/**************************************************/ /**************************************************/
void DrawSheetPath::Push( DrawSheetStruct* aSheet ) void DrawSheetPath::Push( SCH_SHEET* aSheet )
{ {
/**************************************************/ /**************************************************/
/** Function Push /** Function Push
* store (push) aSheet in list * 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 ) if( m_numSheets > DSLSZ )
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \ wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
...@@ -153,11 +153,11 @@ to store sheet" ) ); ...@@ -153,11 +153,11 @@ to store sheet" ) );
} }
DrawSheetStruct* DrawSheetPath::Pop() SCH_SHEET* DrawSheetPath::Pop()
{ {
/** Function Pop /** Function Pop
* retrieves (pop) the last entered sheet and remove it from list * 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 ) if( m_numSheets > 0 )
{ {
...@@ -287,7 +287,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 ) ...@@ -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. /* The constructor: build the list of sheets from aSheet.
...@@ -347,7 +347,7 @@ DrawSheetPath* EDA_SheetList::GetSheet( int aIndex ) ...@@ -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 /** Function BuildSheetList
...@@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet ) ...@@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct* sheet = (DrawSheetStruct*) strct; SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet ); BuildSheetList( sheet );
} }
strct = strct->Next(); strct = strct->Next();
......
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
public: public:
#define DSLSZ 32 // Max number of levels for a sheet path #define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct * m_sheets[DSLSZ]; SCH_SHEET * m_sheets[DSLSZ];
public: DrawSheetPath(); public: DrawSheetPath();
~DrawSheetPath() { }; ~DrawSheetPath() { };
...@@ -97,7 +97,7 @@ public: DrawSheetPath(); ...@@ -97,7 +97,7 @@ public: DrawSheetPath();
* returns a pointer to the last sheet of the list * returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet * One can see the others sheet as the "path" to reach this last sheet
*/ */
DrawSheetStruct* Last(); SCH_SHEET* Last();
/** Function LastScreen /** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list * @return the SCH_SCREEN relative to the last sheet in list
...@@ -112,19 +112,19 @@ public: DrawSheetPath(); ...@@ -112,19 +112,19 @@ public: DrawSheetPath();
/** Function Push /** Function Push
* store (push) aSheet in list * 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 * Push is used when entered a sheet to select or analyze it
* This is like cd <directory> in directories navigation * This is like cd <directory> in directories navigation
*/ */
void Push( DrawSheetStruct* aSheet ); void Push( SCH_SHEET* aSheet );
/** Function Pop /** Function Pop
* retrieves (pop) the last entered sheet and remove it from list * 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 * Pop is used when leaving a sheet after a selection or analyze
* This is like cd .. in directories navigation * This is like cd .. in directories navigation
*/ */
DrawSheetStruct* Pop(); SCH_SHEET* Pop();
/** Function Path /** Function Path
* the path uses the time stamps which do not changes even when editing * the path uses the time stamps which do not changes even when editing
...@@ -202,7 +202,7 @@ public: ...@@ -202,7 +202,7 @@ public:
* If aSheet == NULL (default) build the whole list of sheets in hierarchy * If aSheet == NULL (default) build the whole list of sheets in hierarchy
* So usually call it with no param. * So usually call it with no param.
*/ */
EDA_SheetList( DrawSheetStruct* aSheet = NULL ); EDA_SheetList( SCH_SHEET* aSheet = NULL );
~EDA_SheetList() ~EDA_SheetList()
{ {
...@@ -243,7 +243,7 @@ private: ...@@ -243,7 +243,7 @@ private:
* if aSheet = g_RootSheet, the full sheet path and sheet list is built * if aSheet = g_RootSheet, the full sheet path and sheet list is built
* @param aSheet = the starting sheet from the built is made * @param aSheet = the starting sheet from the built is made
*/ */
void BuildSheetList( DrawSheetStruct* sheet ); void BuildSheetList( SCH_SHEET* sheet );
}; };
#endif /* CLASS_DRAWSHEET_PATH_H */ #endif /* CLASS_DRAWSHEET_PATH_H */
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: class_hierarchical_PIN_sheet.cpp // Name: class_hierarchical_PIN_sheet.cpp
// Purpose: member functions Hierarchical_PIN_Sheet_Struct // Purpose: member functions SCH_SHEET_PIN
// header = class_drawsheet.h // header = class_drawsheet.h
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
/*******************************************************************/ /*******************************************************************/
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
DrawSheetStruct* parent, const wxPoint& pos,
const wxPoint& pos, const wxString& text ) :
const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ), SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
EDA_TextStruct( text ) EDA_TextStruct( text )
{ {
...@@ -43,12 +42,11 @@ Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( ...@@ -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 = SCH_SHEET_PIN* newitem =
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos, new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
m_Text );
newitem->m_Edge = m_Edge; newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape; newitem->m_Shape = m_Shape;
...@@ -61,18 +59,18 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy() ...@@ -61,18 +59,18 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @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; return g_DrawDefaultLineThickness;
} }
/*****************************************************************************/ /*****************************************************************************/
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int DrawMode, int DrawMode,
int Color ) int Color )
{ {
/*****************************************************************************/ /*****************************************************************************/
/* Routine to create hierarchical labels */ /* Routine to create hierarchical labels */
...@@ -124,9 +122,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, ...@@ -124,9 +122,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
* @param aCorner_list = list to fill with polygon corners coordinates * @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape * @param Pos = Position of the shape
*/ */
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape( void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
std::vector <wxPoint>& aCorner_list, const wxPoint& Pos )
const wxPoint& Pos )
{ {
wxSize size = m_Size; wxSize size = m_Size;
...@@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape( ...@@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const bool SCH_SHEET_PIN::Save( FILE* aFile ) const
{ {
int type = 'U', side = 'L'; int type = 'U', side = 'L';
...@@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const ...@@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
#if defined(DEBUG) #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: // XML output:
wxString s = GetClass(); wxString s = GetClass();
......
...@@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT() ...@@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT()
{ {
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */ 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_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
m_Link = NULL; /* For Hierarchical_PIN_Sheet_Struct: m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct * Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin * For Pins: pointer to the component that contains this pin
*/ */
m_Flag = 0; /* flag used in calculations */ m_Flag = 0; /* flag used in calculations */
......
...@@ -41,8 +41,8 @@ class NETLIST_OBJECT ...@@ -41,8 +41,8 @@ class NETLIST_OBJECT
public: public:
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */ 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)*/ 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: SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct * Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin * For Pins: pointer to the component that contains this pin
*/ */
int m_Flag; /* flag used in calculations */ int m_Flag; /* flag used in calculations */
......
...@@ -251,7 +251,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s ) ...@@ -251,7 +251,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
{ {
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE ) if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct* ds = (DrawSheetStruct*) s; SCH_SHEET* ds = (SCH_SHEET*) s;
s = ds->m_AssociatedScreen; s = ds->m_AssociatedScreen;
} }
if( s && s->Type() == SCREEN_STRUCT_TYPE ) if( s && s->Type() == SCREEN_STRUCT_TYPE )
......
...@@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( ...@@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct ) if( DrawStruct )
{ {
( (DrawSheetStruct*) DrawStruct )->DisplayInfo( this ); ( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
return DrawStruct; return DrawStruct;
} }
......
...@@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
Hierarchical_PIN_Sheet_Struct* pinsheet; SCH_SHEET_PIN* pinsheet;
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label; for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
pinsheet; pinsheet;
pinsheet = pinsheet->Next() ) pinsheet = pinsheet->Next() )
{ {
......
...@@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{ {
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel; SCH_SHEET_PIN* SheetLabel, * NextLabel;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
...@@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
continue; continue;
/* See if our item is in this Sheet */ /* See if our item is in this Sheet */
SheetLabel = ( (DrawSheetStruct*) DrawList )->m_Label; SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
if( SheetLabel == NULL ) if( SheetLabel == NULL )
continue; continue;
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct ) if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
{ {
( (DrawSheetStruct*) DrawList )->m_Label = ( (SCH_SHEET*) DrawList )->m_Label =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next(); (SCH_SHEET_PIN*) SheetLabel->Next();
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
return; return;
...@@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{ {
while( SheetLabel->Next() ) while( SheetLabel->Next() )
{ {
NextLabel = NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct ) if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
{ {
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() ); SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
......
...@@ -13,7 +13,7 @@ ...@@ -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 ) /* Free (delete) all schematic data (include the sub hierarchy sheets )
...@@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion ) ...@@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next(); EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct, DeleteSubHierarchy( (SCH_SHEET*) DrawStruct,
confirm_deletion ); confirm_deletion );
} }
} }
......
...@@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel, ...@@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
DrawSheetStruct* Struct = (DrawSheetStruct*) aItem; SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox, GRRect( &aPanel->m_ClipBox,
aDC, aDC,
Struct->m_Pos.x + aOffset.x, Struct->m_Pos.x + aOffset.x,
......
...@@ -49,7 +49,7 @@ int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT; ...@@ -49,7 +49,7 @@ int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
DrawSheetStruct* g_RootSheet = NULL; SCH_SHEET* g_RootSheet = NULL;
wxString g_NetCmpExtBuffer( wxT( "cmp" ) ); wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
......
...@@ -198,17 +198,17 @@ int TestDuplicateSheetNames() ...@@ -198,17 +198,17 @@ int TestDuplicateSheetNames()
continue; continue;
// We have found a second sheet: compare names // We have found a second sheet: compare names
if( ( (DrawSheetStruct*) ref_item )->m_SheetName.CmpNoCase( if( ( (SCH_SHEET*) ref_item )->m_SheetName.CmpNoCase(
( ( DrawSheetStruct* ) item_to_test )-> m_SheetName ) ( ( SCH_SHEET* ) item_to_test )-> m_SheetName )
== 0 ) == 0 )
{ {
/* Create a new marker type ERC error*/ /* Create a new marker type ERC error*/
MARKER_SCH* Marker = new MARKER_SCH(); MARKER_SCH* Marker = new MARKER_SCH();
Marker->m_TimeStamp = GetTimeStamp(); Marker->m_TimeStamp = GetTimeStamp();
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME, Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (DrawSheetStruct*) item_to_test )->m_Pos, ( (SCH_SHEET*) item_to_test )->m_Pos,
_( "Duplicate Sheet name" ), _( "Duplicate Sheet name" ),
( (DrawSheetStruct*) item_to_test )->m_Pos ); ( (SCH_SHEET*) item_to_test )->m_Pos );
Marker->SetMarkerType( MARK_ERC ); Marker->SetMarkerType( MARK_ERC );
Marker->SetErrorLevel( ERR ); Marker->SetErrorLevel( ERR );
Marker->SetNext( Screen->EEDrawList ); Marker->SetNext( Screen->EEDrawList );
......
...@@ -15,12 +15,10 @@ ...@@ -15,12 +15,10 @@
#include "class_library.h" #include "class_library.h"
/****************************************************************/
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/
/* Commands to save project or the current page. /* Commands to save project or the current page.
*/ */
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -45,7 +43,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -45,7 +43,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
} }
/* /**
* Load an entire project * Load an entire project
* *
* Schematic root file and its subhierarchies, the configuration and the libs * Schematic root file and its subhierarchies, the configuration and the libs
...@@ -60,7 +58,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -60,7 +58,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() )
{ {
if( screen->IsModify() ) if( screen->IsModify() )
break; break;
...@@ -68,7 +67,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -68,7 +67,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
if( screen ) if( screen )
{ {
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) ) if( !IsOK( this, _( "Clear schematic hierarchy?" ) ) )
return FALSE; return FALSE;
if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName ) if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName ); SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
...@@ -126,7 +125,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -126,7 +125,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
return 1; return 1;
} }
// Rechargement de la configuration: // Reloading configuration.
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd(); msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg ); PrintMsg( msg );
...@@ -145,7 +144,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -145,7 +144,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
/* Loading the project library cache /* Loading the project library cache
* until apr 2009 the lib is named <root_name>.cache.lib * until apr 2009 the lib is named <root_name>.cache.lib
* and after (due to code change): <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; bool use_oldcachename = false;
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName; wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
...@@ -208,11 +207,11 @@ Error: %s" ), ...@@ -208,11 +207,11 @@ Error: %s" ),
return -1; return -1;
} }
//load the project. // load the project.
SAFE_DELETE( g_RootSheet->m_AssociatedScreen ); SAFE_DELETE( g_RootSheet->m_AssociatedScreen );
bool diag = g_RootSheet->Load( this ); bool diag = g_RootSheet->Load( this );
/* Reaffichage ecran de base (ROOT) si necessaire */ /* Redraw base screen (ROOT) if necessary. */
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
Zoom_Automatique( FALSE ); Zoom_Automatique( FALSE );
...@@ -222,15 +221,13 @@ Error: %s" ), ...@@ -222,15 +221,13 @@ Error: %s" ),
} }
/**********************************************************/ /* Create a new screen
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( *
SCH_SCREEN* OldScreen, int TimeStamp ) * This screen is chained with OldScreen. The timestamp value is assigned to
/**********************************************************/ * the parameter NewScreen-> 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
*/ */
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN* OldScreen,
int TimeStamp )
{ {
SCH_SCREEN* NewScreen; SCH_SCREEN* NewScreen;
...@@ -247,13 +244,12 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( ...@@ -247,13 +244,12 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
} }
/****************************************************/ /**
void WinEDA_SchematicFrame::SaveProject() * Save the entire project and create an archive for components.
/****************************************************/ *
* The library archive name is <root_name>.cache.lib
/* Saves the entire project and creates an archive for components
* the library archive name is <root_name>.cache.lib
*/ */
void WinEDA_SchematicFrame::SaveProject()
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxFileName fn; wxFileName fn;
...@@ -266,7 +262,7 @@ void WinEDA_SchematicFrame::SaveProject() ...@@ -266,7 +262,7 @@ void WinEDA_SchematicFrame::SaveProject()
SaveEEFile( screen, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );
} }
/* Creation du fichier d'archivage composants en repertoire courant */ /* Archive components in current directory. */
fn = g_RootSheet->GetFileName(); fn = g_RootSheet->GetFileName();
wxString cachename = fn.GetName() + wxT("-cache"); wxString cachename = fn.GetName() + wxT("-cache");
fn.SetName( cachename ); fn.SetName( cachename );
...@@ -275,38 +271,13 @@ void WinEDA_SchematicFrame::SaveProject() ...@@ -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, int CountCmpNumber()
* powers non comprises */
{ {
return g_RootSheet->ComponentCount(); 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_ #ifndef _GENERAL_H_
#define _GENERAL_H_ #define _GENERAL_H_
/* Entete des fichiers schematique */
#define EESCHEMA_VERSION 2 #define EESCHEMA_VERSION 2
#define SCHEMATIC_HEAD_STRING "Schematic File Version" #define SCHEMATIC_HEAD_STRING "Schematic File Version"
...@@ -15,12 +14,11 @@ ...@@ -15,12 +14,11 @@
#define MAX_PIN_INFO 10 #define MAX_PIN_INFO 10
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places #define TXTMARGE 10 /* Offset in mils for placement of labels
* sur fils ( labels, num pins ) */ * and pin numbers. */
#define HIGHLIGHT_COLOR WHITE #define HIGHLIGHT_COLOR WHITE
/* Used for EDA_BaseStruct, .m_Select member */ /* Used for EDA_BaseStruct, .m_Select member */
#define IS_SELECTED 1 #define IS_SELECTED 1
...@@ -32,10 +30,9 @@ ...@@ -32,10 +30,9 @@
#define DANGLING_SYMBOL_SIZE 12 #define DANGLING_SYMBOL_SIZE 12
/* Message de presentation */
extern wxString g_DefaultSchematicFileName; extern wxString g_DefaultSchematicFileName;
/* Masque de recherche pour localisation d'objets a editer */ /* Search mask for locating objects in editor. */
#define LIBITEM 1 #define LIBITEM 1
#define WIREITEM 2 #define WIREITEM 2
#define BUSITEM 4 #define BUSITEM 4
...@@ -53,12 +50,13 @@ extern wxString g_DefaultSchematicFileName; ...@@ -53,12 +50,13 @@ extern wxString g_DefaultSchematicFileName;
#define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000 #define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000
#define WIRE_BUS_ENDPOINTS_ONLY 0x8000 #define WIRE_BUS_ENDPOINTS_ONLY 0x8000
#define SEARCHALL LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | JUNCTIONITEM \ #define SEARCHALL ( LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | \
| DRAWITEM | TEXTITEM | LABELITEM | SHEETITEM | MARKERITEM \ JUNCTIONITEM | DRAWITEM | TEXTITEM | LABELITEM | \
| NOCONNECTITEM | SEARCH_PINITEM | SHEETLABELITEM SHEETITEM | MARKERITEM | NOCONNECTITEM | \
SEARCH_PINITEM | SHEETLABELITEM )
/* Numero des couches de travail */ typedef enum
typedef enum { {
LAYER_WIRE, LAYER_WIRE,
LAYER_BUS, LAYER_BUS,
LAYER_JUNCTION, LAYER_JUNCTION,
...@@ -84,39 +82,44 @@ typedef enum { ...@@ -84,39 +82,44 @@ typedef enum {
LAYER_ERC_ERR, LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND, LAYER_DEVICE_BACKGROUND,
MAX_LAYER /* Nombre de couches */ MAX_LAYER /* Maximum layers */
} LayerNumber; } LayerNumber;
typedef enum {
typedef enum
{
FILE_SAVE_AS, FILE_SAVE_AS,
FILE_SAVE_NEW FILE_SAVE_NEW
} FileSaveType; } FileSaveType;
/* variables generales */ extern int g_OptNetListUseNames; /* TRUE to use names rather than
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que * net numbers (PSPICE netlist
* les numeros (netlist PSPICE seulement) */ * only) */
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
* dessinee pouvant etre dupliquee par la commande * by the repeat command. NULL if no
* Repeat ( NULL si aucune struct existe ) */ * item to repeat */
extern wxSize g_RepeatStep; extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel; extern int g_RepeatDeltaLabel;
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item 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 extern bool g_LastSearchIsMarker; /* True if last search is a marker
// False for a schematic item search * search. False for a schematic
// Used for hotkey next search * item search. Used for hotkey
* next search. */
/* Block operation (copy, paste) */ /* 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; extern bool g_HVLines;
// Gestion de diverses variables, options... devant etre memorisees mais // Management variables, option ... to be stored. Reset to 0 during a
// Remises a 0 lors d'un rechargement de projetc // project reload.
struct EESchemaVariables struct EESchemaVariables
{ {
int NbErrorErc; int NbErrorErc;
...@@ -125,40 +128,19 @@ struct EESchemaVariables ...@@ -125,40 +128,19 @@ struct EESchemaVariables
extern struct EESchemaVariables g_EESchemaVar; extern struct EESchemaVariables g_EESchemaVar;
/* Variables globales pour Schematic Edit */
extern int g_DefaultTextLabelSize; 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 struct HPGL_Pen_Descr_Struct
{ {
int m_Pen_Num; /* num de plume a charger */ int m_Pen_Num; /* Pen number */
int m_Pen_Speed; /* vitesse en cm/s */ int m_Pen_Speed; /* Pen speed in cm/s */
int m_Pen_Diam; /* Pen diameter in mils */ int m_Pen_Diam; /* Pen diameter in mils */
}; };
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* First and main (root) screen */ /* First and main (root) screen */
extern DrawSheetStruct* g_RootSheet; extern SCH_SHEET* 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
/* Gestion des librairies schematiques */
extern wxString g_NetCmpExtBuffer; extern wxString g_NetCmpExtBuffer;
extern const wxString SymbolFileExtension; extern const wxString SymbolFileExtension;
...@@ -167,23 +149,28 @@ extern const wxString SymbolFileWildcard; ...@@ -167,23 +149,28 @@ extern const wxString SymbolFileWildcard;
extern const wxString CompLibFileExtension; extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard; extern const wxString CompLibFileWildcard;
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..) extern wxString g_SimulatorCommandLine;
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..) 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 extern bool g_EditPinByPinIsOn; /* True to prevent displacing
* when they are at the same location */ * pins, when they are at the
* same position. */
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA
* used to draw/plot items having a default thickness line value (i.e. = 0 ). * units) thickness used to
* 0 = single pixel line width * draw/plot items having a
* default thickness line
* value (i.e. = 0 ).
* 0 = single pixel line width
*/ */
// Color to draw selected items // Color to draw selected items
extern int g_ItemSelectetColor; 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; extern int g_InvisibleItemColor;
#endif // _GENERAL_H_ #endif // _GENERAL_H_
...@@ -20,11 +20,9 @@ ...@@ -20,11 +20,9 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC );
/* Variables locales */
static int OldTransMat[2][2]; static int OldTransMat[2][2];
static wxPoint OldPos; static wxPoint OldPos;
...@@ -200,7 +198,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -200,7 +198,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert, Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
GetScreen()->m_Curseur, true ); 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->GetField( VALUE )->m_Text = Name;
Component->DisplayInfo( this ); Component->DisplayInfo( this );
...@@ -210,10 +209,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -210,10 +209,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
} }
/**************************************************************************/ /**
/*** Routine de deplacement du composant. ***/ * Move a component.
/*** Appele par GeneralControle grace a ActiveScreen->ManageCurseur. ***/ */
/**************************************************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
wxPoint move_vector; wxPoint move_vector;
...@@ -222,7 +220,6 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -222,7 +220,6 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem(); SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
/* Effacement du composant */
if( erase ) if( erase )
{ {
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) ); DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
...@@ -236,8 +233,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -236,8 +233,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* /*
* Routine permettant les rotations et les miroirs d'un composant * Routine to rotate and mirror a component.
* Si DC = NULL : pas de redessin *
** If DC == NULL: no repaint
*/ */
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate ) wxDC* DC, int type_rotate )
...@@ -245,7 +243,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, ...@@ -245,7 +243,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
/* Efface le trace precedent */ /* Deletes the previous component. */
if( DC ) if( DC )
{ {
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
...@@ -259,7 +257,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, ...@@ -259,7 +257,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
DrawComponent->SetRotationMiroir( type_rotate ); DrawComponent->SetRotationMiroir( type_rotate );
/* Redessine le composant dans la nouvelle position */ /* Redraw the component in the new position. */
if( DC ) if( DC )
{ {
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
...@@ -276,7 +274,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, ...@@ -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 ) static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
...@@ -284,12 +282,12 @@ 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(); 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; Component->m_Flags = 0;
SAFE_DELETE( Component ); SAFE_DELETE( Component );
} }
else if( Component ) /* Deplacement ancien composant en cours */ else if( Component )
{ {
wxPoint move_vector = OldPos - Component->m_Pos; wxPoint move_vector = OldPos - Component->m_Pos;
Component->Move( move_vector ); Component->Move( move_vector );
...@@ -305,7 +303,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -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, void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC ) int unit, wxDC* DC )
...@@ -333,17 +331,16 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, ...@@ -333,17 +331,16 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( unit > m_UnitCount ) if( unit > m_UnitCount )
unit = m_UnitCount; unit = m_UnitCount;
/* Efface le trace precedent */
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); 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->SetUnitSelection( GetSheet(), unit );
DrawComponent->m_Multi = unit; DrawComponent->m_Multi = unit;
/* Redessine le composant dans la nouvelle position */ /* Redraw the component in the new position. */
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
...@@ -374,7 +371,6 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -374,7 +371,6 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
return; return;
} }
/* Efface le trace precedent */
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
...@@ -390,7 +386,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -390,7 +386,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Convert > 2 ) if( DrawComponent->m_Convert > 2 )
DrawComponent->m_Convert = 1; DrawComponent->m_Convert = 1;
/* Redessine le composant dans la nouvelle position */ /* Redraw the component in the new position. */
if( DrawComponent->m_Flags & IS_MOVED ) if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
...@@ -432,9 +428,9 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component, ...@@ -432,9 +428,9 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
#if 1 #if 1
// switch from normal mode to xor mode for the duration of the move, first // 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(), // by erasing fully any "normal drawing mode" primitives with the
// then by drawing the first time in xor mode so that subsequent xor // PostDirtyRect(), then by drawing the first time in xor mode so that
// drawing modes will fully erase this first copy. // subsequent xor drawing modes will fully erase this first copy.
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
DrawPanel->PostDirtyRect( Component->GetBoundingBox() ); DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
......
/************************************************************************/ /******************/
/* hierarch.cpp: Gestion de la hierarchie: navigation dans les feuilles */ /* hierarch.cpp */
/************************************************************************/ /******************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -18,15 +18,16 @@ ...@@ -18,15 +18,16 @@
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ); static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
enum { enum
{
ID_TREECTRL_HIERARCHY = 1600 ID_TREECTRL_HIERARCHY = 1600
}; };
class WinEDA_HierFrame; class WinEDA_HierFrame;
/* This class derived from wxTreeItemData stores the DrawSheetPath of each sheet in hierarcy /* This class derived from wxTreeItemData stores the DrawSheetPath of each
* in each TreeItem, in its associated data buffer * sheet in hierarchy in each TreeItem, in its associated data buffer
*/ */
class TreeItemData : public wxTreeItemData class TreeItemData : public wxTreeItemData
{ {
...@@ -38,7 +39,7 @@ public: ...@@ -38,7 +39,7 @@ public:
} }
}; };
/* Classe de l'arbre de hierarchie */ /* Class to handle hierarchy tree. */
class WinEDA_Tree : public wxTreeCtrl class WinEDA_Tree : public wxTreeCtrl
{ {
private: private:
...@@ -71,7 +72,6 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) : ...@@ -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 class WinEDA_HierFrame : public wxDialog
{ {
public: public:
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
wxDC* m_DC; wxDC* m_DC;
private: private:
wxSize m_TreeSize; // Taille de l'arbre de hierarchie wxSize m_TreeSize;
int maxposx; int maxposx;
public: public:
...@@ -153,7 +153,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, ...@@ -153,7 +153,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC,
{ {
m_Tree->Expand( cellule ); 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.y += m_nbsheets * itemrect.GetHeight();
m_TreeSize.x = MIN( m_TreeSize.x, 250 ); m_TreeSize.x = MIN( m_TreeSize.x, 250 );
m_TreeSize.y = MIN( m_TreeSize.y, 350 ); m_TreeSize.y = MIN( m_TreeSize.y, 350 );
...@@ -176,15 +176,13 @@ void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) ...@@ -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, 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; wxTreeItemId menu;
...@@ -206,7 +204,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list, ...@@ -206,7 +204,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
{ {
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem; SCH_SHEET* sheet = (SCH_SHEET*) schitem;
m_nbsheets++; m_nbsheets++;
menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 ); menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
list->Push( sheet ); list->Push( sheet );
...@@ -236,13 +234,11 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list, ...@@ -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: /* 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(); wxTreeItemId ItemSel = m_Tree->GetSelection();
...@@ -253,12 +249,10 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event ) ...@@ -253,12 +249,10 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
} }
/******************************************************/ /* Set the current screen to display the parent sheet of the current
void WinEDA_SchematicFrame::InstallPreviousSheet() * 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 ) if( m_CurrentSheet->Last() == g_RootSheet )
return; return;
...@@ -279,16 +273,13 @@ void WinEDA_SchematicFrame::InstallPreviousSheet() ...@@ -279,16 +273,13 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
} }
/*********************************************************************/ /* Routine installation of the screen corresponding to the symbol edge Sheet
void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* 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
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe * maintain path info..)
* 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..)
*/ */
void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet )
{ {
if( Sheet == NULL ) if( Sheet == NULL )
{ {
...@@ -301,14 +292,10 @@ void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet ) ...@@ -301,14 +292,10 @@ void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
} }
/**************************************************************/ /* Find and install the screen on the sheet symbol Sheet.
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ) * If Sheet == NULL installation of the screen base (Root).
/**************************************************************/
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
* Si Sheet == NULL installation de l'ecran de base ( Root ).
*/ */
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
{ {
SCH_SCREEN* NewScreen; SCH_SCREEN* NewScreen;
...@@ -319,8 +306,8 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ) ...@@ -319,8 +306,8 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
return false; return false;
} }
// Reinit des parametres d'affichage du nouvel ecran // Reset display settings of the new screen
// assumes m_CurrentSheet has already been updated. // Assumes m_CurrentSheet has already been updated.
frame->ClearMsgPanel(); frame->ClearMsgPanel();
frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar, frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
NewScreen->m_ZoomScalar, NewScreen->m_ZoomScalar,
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
/* EESchema - lib_export.cpp */ /* EESchema - lib_export.cpp */
/*****************************/ /*****************************/
/* Routines de maintenanace des librariries: /* Library maintenance routines.
* sauvegarde, modification de librairies. * Backup modified libraries.
* creation edition suppression de composants * Create, edit, and delete components.
*/ */
#include "fctsys.h" #include "fctsys.h"
...@@ -27,13 +27,11 @@ ...@@ -27,13 +27,11 @@
extern int ExportPartId; extern int ExportPartId;
/*************************************************/ /* Routine to read one part.
/* Routine de lecture de 1 description. * The format is that of libraries, but it loads only 1 component.
* Le format est celui des librairies, mais on ne charge que 1 composant * Or 1 component if there are several.
* ou le 1er composant s'il y en a plusieurs. * If the first component is an alias, it will load the corresponding root.
* Si le premier composant est un alias, on chargera la racine correspondante
*/ */
/*************************************************/
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{ {
wxString errMsg; wxString errMsg;
...@@ -82,12 +80,12 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -82,12 +80,12 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
} }
/* Routine de creation d'une nouvelle librairie et de sauvegarde du /* Routine to create a new library and backup the current component in
* composant courant dans cette librarie * this library.
* si create_lib == TRUE sauvegarde dans le repertoire des libr * Create_lib == TRUE if the backup directory of library.
* sinon: sauvegarde sous le nom demande sans modifications. * 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 ) void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
{ {
......
/**************************************************************/ /*****************************************************/
/* libarch.cc */ /* libarch.cpp */
/* Module de generation du fichier d'archivage des composants */ /* Module for generation of component archive files. */
/**************************************************************/ /*****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
...@@ -29,7 +29,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) ...@@ -29,7 +29,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName ); libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
libCache->SetCache(); 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 * found in lib complex hierarchies are not a problem because we just want
* to know used components in libraries * to know used components in libraries
*/ */
...@@ -52,7 +52,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) ...@@ -52,7 +52,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
if( !libCache->Save( 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 ) ); library <%s>." ), GetChars( ArchFullFileName ) );
DisplayError( frame, msg ); DisplayError( frame, msg );
return false; return false;
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
/* EESchema - libedit.cpp */ /* EESchema - libedit.cpp */
/****************************/ /****************************/
/* Routines de maintenanace des librairies:
* sauvegarde, modification de librairies.
* creation edition suppression de composants
*/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -118,11 +113,11 @@ library \"%s\"." ), ...@@ -118,11 +113,11 @@ library \"%s\"." ),
/* /*
* Routine Pour Charger en memoire la copie de 1 libpart. * Routine to load into memory a copy of 1 library part.
* retourne * Returns
* 0 si OK * 0 if OK
* 1 si err * 1 if error
* m_component pointe la copie ainsi creee * m_component advanced copy and created
*/ */
bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry, bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
CMP_LIBRARY* Library ) CMP_LIBRARY* Library )
...@@ -208,7 +203,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -208,7 +203,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DC->SetBackgroundMode( wxTRANSPARENT ); DC->SetBackgroundMode( wxTRANSPARENT );
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
DrawPanel->CursorOff( DC ); // erase cursor DrawPanel->CursorOff( DC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, false );
...@@ -289,8 +284,9 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event ) ...@@ -289,8 +284,9 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
/* /*
* Affiche la documentation du composant selectionne * Display the documentation of the selected component.
* Utilise lors de l'affichage de la liste des composants en librairie *
* Used when displaying the list of library components.
*/ */
void WinEDA_LibeditFrame::DisplayCmpDoc() void WinEDA_LibeditFrame::DisplayCmpDoc()
{ {
...@@ -354,16 +350,18 @@ void WinEDA_LibeditFrame::DisplayCmpDoc() ...@@ -354,16 +350,18 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
/* /*
* Routine de suppression d'un composant dans la librairie courante * Delete component in the current library.
* (effacement en memoire uniquement, le fichier n'est pas modifie) *
* Le composant peut etre un alias, ou la definition de base. * (Delete only in memory, the file does not change)
* Si c'est un alias: *
* il est supprime, et la liste des alias de la definition * The entry can be an alias or a component.
* de base est modifiee * If an alias:
* Si c'est le composant de base: * It is removed, and the list of alias is updated.
* Si la liste des alias est nulle, il est supprime *
* Sinon le premier alias devient le composant de base, et les autres * If a component:
* alias deviennent dependants de celui ci. * 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 ) void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
{ {
...@@ -515,7 +513,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) ...@@ -515,7 +513,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
name = dlg.GetName().MakeUpper(); name = dlg.GetName().MakeUpper();
name.Replace( wxT( " " ), wxT( "_" ) ); 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 ) ) if( m_library && m_library->FindEntry( name ) )
{ {
wxString msg; wxString msg;
...@@ -570,11 +568,11 @@ lost!\n\nClear the current component from the screen?" ) ) ) ...@@ -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 * Save in memory only and NOT on file.
* La routine efface l'ancien composant ( ou / et les alias ) a remplacer * The routine deletes the old component (and / or aliases) to replace
* s'il existe, et sauve le nouveau et cree les alias correspondants. * If any, and saves the new and creates the corresponding alias.
*/ */
void WinEDA_LibeditFrame::SaveOnePartInMemory() void WinEDA_LibeditFrame::SaveOnePartInMemory()
{ {
......
/*********************************************************************/ /*****************************************************/
/* EESchema - edition des librairies: Edition des champs ( Fields ) */ /* Component library edit field manipulation code. */
/*********************************************************************/ /*****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -15,11 +15,9 @@ ...@@ -15,11 +15,9 @@
#include "class_library.h" #include "class_library.h"
/* Routines locales */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */
extern int m_unit; extern int m_unit;
static wxPoint StartCursor, LastTextPosition; static wxPoint StartCursor, LastTextPosition;
...@@ -49,9 +47,6 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -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 ) void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
{ {
wxPoint startPos; wxPoint startPos;
...@@ -78,10 +73,10 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field ) ...@@ -78,10 +73,10 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
} }
/*****************************************************************/ /*
/* Routine d'affichage du texte 'Field' en cours de deplacement. */ * Routine to display text 'Field' on the move.
/* Routine normalement attachee au curseur */ * Normally called by cursor management code.
/*****************************************************************/ */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent(); WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
...@@ -228,9 +223,10 @@ not conflict with any library entries." ), ...@@ -228,9 +223,10 @@ not conflict with any library entries." ),
/* /*
* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ. * Rotate a field horizontally or vertically.
* si un champ est en cours d'edition, modif de celui ci. *
* sinon Modif du champ pointe par la souris * 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 ) void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
{ {
......
...@@ -148,30 +148,30 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame ) ...@@ -148,30 +148,30 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style ) WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "LibeditFrame" ); m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis m_Draw_Axis = true; // true to draw axis
m_Draw_Grid = true; // true to draw grid m_Draw_Grid = true; // true to draw grid
m_ConfigPath = wxT( "LibraryEditor" ); m_ConfigPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false ); SetShowDeMorgan( false );
m_drawSpecificConvert = true; m_drawSpecificConvert = true;
m_drawSpecificUnit = false; m_drawSpecificUnit = false;
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
SetBaseScreen( new SCH_SCREEN() ); SetBaseScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; GetScreen()->m_Center = true;
LoadSettings(); LoadSettings();
// Initilialize grid id to a default value if not found in config or bad: // Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) || if( (m_LastGridSizeId <= 0)
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) || ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - 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 ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
...@@ -189,32 +189,33 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -189,32 +189,33 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
Show( true ); Show( true );
#if KICAD_AUIMANAGER #if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this); m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz; wxAuiPaneInfo horiz;
horiz.Gripper(false); horiz.Gripper( false );
horiz.DockFixed(true); horiz.DockFixed( true );
horiz.Movable(false); horiz.Movable( false );
horiz.Floatable(false); horiz.Floatable( false );
horiz.CloseButton(false); horiz.CloseButton( false );
horiz.CaptionVisible(false); horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz); wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable(false).RightDockable(false); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); 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(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(); m_auimgr.Update();
#endif #endif
} }
...@@ -224,6 +225,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame() ...@@ -224,6 +225,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
{ {
WinEDA_SchematicFrame* frame = WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL; frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
} }
...@@ -288,8 +290,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -288,8 +290,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
GetScreen()->ClrModify(); GetScreen()->ClrModify();
} }
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() ) BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) {
{
if( lib.IsModified() ) if( lib.IsModified() )
{ {
wxString msg; wxString msg;
...@@ -351,8 +352,8 @@ int WinEDA_LibeditFrame::BestZoom() ...@@ -351,8 +352,8 @@ int WinEDA_LibeditFrame::BestZoom()
} }
size -= wxSize( 25, 25 ); // reserve 100 mils margin size -= wxSize( 25, 25 ); // reserve 100 mils margin
ii = wxRound( ( (double) dx / (double) size.x ) * ii = wxRound( ( (double) dx / (double) size.x ) *
(double) GetScreen()->m_ZoomScalar ); (double) GetScreen()->m_ZoomScalar );
jj = wxRound( ( (double) dy / (double) size.y ) * jj = wxRound( ( (double) dy / (double) size.y ) *
(double) GetScreen()->m_ZoomScalar ); (double) GetScreen()->m_ZoomScalar );
...@@ -495,8 +496,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event ) ...@@ -495,8 +496,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
event.Enable( GetShowDeMorgan() || event.Enable( GetShowDeMorgan()
(m_component && m_component->HasConversion()) ); || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 ); m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
} }
...@@ -506,8 +507,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event ) ...@@ -506,8 +507,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
event.Enable( GetShowDeMorgan() || event.Enable( GetShowDeMorgan()
(m_component && m_component->HasConversion()) ); || ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 ); m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
} }
...@@ -521,7 +522,7 @@ void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event ) ...@@ -521,7 +522,7 @@ void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event )
* so use the pointer to alias combobox to directly enable or disable. * so use the pointer to alias combobox to directly enable or disable.
*/ */
m_SelAliasBox->Enable( m_component != NULL 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 ) ...@@ -533,7 +534,8 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
if( m_SelAliasBox->GetStringSelection().CmpNoCase(m_component->GetName() ) == 0 ) if( m_SelAliasBox->GetStringSelection().CmpNoCase( m_component->GetName() )
== 0 )
m_aliasName.Empty(); m_aliasName.Empty();
else else
m_aliasName = m_SelAliasBox->GetStringSelection(); m_aliasName = m_SelAliasBox->GetStringSelection();
...@@ -710,7 +712,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -710,7 +712,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBEDIT_IMPORT_BODY_BUTT: case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) ); SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol( ); LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
...@@ -767,6 +769,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -767,6 +769,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
// Delete the last created segment, while creating a polyline draw item // Delete the last created segment, while creating a polyline draw item
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
......
...@@ -27,7 +27,7 @@ private: ...@@ -27,7 +27,7 @@ private:
// Flags // Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog 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: public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame( wxWindow* father,
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom int BestZoom();
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event );
......
/****************************************/ /****************************************/
/* Module to load/save EESchema files. */ /* Module to load/save EESchema files. */
/****************************************/ /****************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -29,7 +29,6 @@ extern int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -29,7 +29,6 @@ extern int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
wxString& aMsgDiag, int* aLineNum, wxString& aMsgDiag, int* aLineNum,
BASE_SCREEN* Window ); BASE_SCREEN* Window );
/* Fonctions locales */
static void LoadLayers( FILE* f, int* linecnt ); static void LoadLayers( FILE* f, int* linecnt );
...@@ -118,7 +117,8 @@ again." ); ...@@ -118,7 +117,8 @@ again." );
} }
// Read the rest of a potentially very long line. fgets() puts a '\n' into // 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' ) if( Line[ strlen( Line )-1 ] != '\n' )
{ {
int c; int c;
...@@ -136,7 +136,7 @@ again." ); ...@@ -136,7 +136,7 @@ again." );
switch( Line[0] ) switch( Line[0] )
{ {
case '$': /* identification de bloc */ case '$': /* identification block */
if( Line[1] == 'C' ) if( Line[1] == 'C' )
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
screen ); screen );
...@@ -148,32 +148,32 @@ again." ); ...@@ -148,32 +148,32 @@ again." );
else if( Line[1] == 'D' ) else if( Line[1] == 'D' )
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount, Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount,
screen ); screen );
else if( Line[1] == 'T' ) //text part else if( Line[1] == 'T' ) //text part
{ {
printf("**** TEXT PART\n"); printf("**** TEXT PART\n");
SCH_ITEM* Struct; SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line), Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
&LineCount, version); &LineCount, version);
if( Struct ) if( Struct )
{ {
Struct->SetNext( screen->EEDrawList ); Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct; screen->EEDrawList = Struct;
} }
else else
Failed = true; Failed = true;
} }
break; break;
case 'L': /* Its a library item. */ case 'L': /* Its a library item. */
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen ); Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
break; /* Fin lecture 1 composant */ break;
case 'W': /* Its a Segment (WIRE or BUS) item. */ case 'W': /* Its a Segment (WIRE or BUS) item. */
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 ) 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 ); LineCount );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line ); MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
Failed = true; Failed = true;
...@@ -209,7 +209,7 @@ again." ); ...@@ -209,7 +209,7 @@ again." );
break; 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 ) if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
{ {
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ), MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
...@@ -325,7 +325,8 @@ at line %d, aborted" ), ...@@ -325,7 +325,8 @@ at line %d, aborted" ),
break; break;
case 'K': /* It is a Marker item. */ 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; break;
case 'T': /* It is a text item. */ case 'T': /* It is a text item. */
...@@ -398,7 +399,7 @@ static void LoadLayers( FILE* f, int* linecnt ) ...@@ -398,7 +399,7 @@ static void LoadLayers( FILE* f, int* linecnt )
sscanf( Line, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer ); sscanf( Line, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
if( strcmp( Name, "EELAYER" ) !=0 ) if( strcmp( Name, "EELAYER" ) !=0 )
{ {
/* error : init par defaut */ /* error : init par default */
Number = MAX_LAYER; Number = MAX_LAYER;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**********************************************/ /***************/
/* Module de calcul de la Netliste: netlist.h */ /* netlist.h */
/**********************************************/ /***************/
#ifndef _NETLIST_H_ #ifndef _NETLIST_H_
#define _NETLIST_H_ #define _NETLIST_H_
...@@ -37,7 +37,6 @@ enum TypeNetForm { ...@@ -37,7 +37,6 @@ enum TypeNetForm {
#define MAXPIN 5000 #define MAXPIN 5000
/* object used in annotation to handle a list of components in schematic /* object used in annotation to handle a list of components in schematic
* because in a complex hierarchy, a component is used more than once, * because in a complex hierarchy, a component is used more than once,
* and its reference is depending on the sheet path * and its reference is depending on the sheet path
...@@ -47,16 +46,23 @@ enum TypeNetForm { ...@@ -47,16 +46,23 @@ enum TypeNetForm {
class OBJ_CMP_TO_LIST class OBJ_CMP_TO_LIST
{ {
public: public:
SCH_COMPONENT* m_RootCmp; // the component in schematic SCH_COMPONENT* m_RootCmp; // the component in schematic
LIB_COMPONENT* m_Entry; // the source component in library LIB_COMPONENT* m_Entry; // the source component in library
int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */ int m_Unit; /* Selected part (For multi parts per
DrawSheetPath m_SheetPath; /* the sheet path for this component */ * package) depending on sheet path */
unsigned long m_TimeStamp; /* unique identification number depending on sheet path */ DrawSheetPath m_SheetPath; /* the sheet path for this component */
bool m_IsNew; /* true for not yet annotated components */ unsigned long m_TimeStamp; /* unique identification number
wxString* m_Value; /* Component value (same for all instances) */ * depending on sheet path */
char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */ bool m_IsNew; /* true for not yet annotated
int m_NumRef; /* Reference number (for IC1, this is 1) ) depending on sheet path*/ * components */
int m_Flag; /* flag for computations */ 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: public:
OBJ_CMP_TO_LIST() OBJ_CMP_TO_LIST()
...@@ -96,7 +102,7 @@ public: ...@@ -96,7 +102,7 @@ public:
// Buffer to build the list of items used in netlist and erc calculations // Buffer to build the list of items used in netlist and erc calculations
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST; typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
extern NETLIST_OBJECT_LIST g_NetObjectslist; extern NETLIST_OBJECT_LIST g_NetObjectslist;
/* Prototypes: */ /* Prototypes: */
...@@ -110,7 +116,8 @@ void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist ); ...@@ -110,7 +116,8 @@ void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
* @param first = true: return first name of the list, false = return next * @param first = true: return first name of the list, false = return next
* @return a wxString : name of the type netlist or empty string * @return a wxString : name of the type netlist or empty string
* this function must be called first with "first_item" = true * 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 ); wxString ReturnUserNetlistTypeName( bool first_item );
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
/**********************************/ /**********************************/
/* Functions relatives to the dialog creating the netlist for pcbnew. /* 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 * PCBNEW ORCADPCB2 CADSTAR and SPICE
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format * and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
* calling an external converter with convert an intermediate format to the * calling an external converter with convert an intermediate format to the
* user specific format. * 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 * but there are not really plugins, there are only external binaries
*/ */
...@@ -306,7 +306,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -306,7 +306,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii ); selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
/* Install the panel "Add Plugin" after /* Install the panel "Add Plugin" after
* the last initialised panel */ * the last initialized panel */
previoustitle = title; previoustitle = title;
if( title.IsEmpty() ) if( title.IsEmpty() )
CurrPage = CurrPage =
...@@ -357,10 +357,10 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) ...@@ -357,10 +357,10 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
Mask = wxT( "*" ); Mask = wxT( "*" );
Path = wxGetApp().m_BinDir; Path = wxGetApp().m_BinDir;
FullFileName = EDA_FileSelector( _( "Plugin files:" ), FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, /* Chemin par defaut */ Path,
FullFileName, /* nom fichier par defaut */ FullFileName,
wxEmptyString, /* extension par defaut */ wxEmptyString,
Mask, /* Masque d'affichage */ Mask,
this, this,
wxFD_OPEN, wxFD_OPEN,
TRUE TRUE
...@@ -379,7 +379,8 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) ...@@ -379,7 +379,8 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString title = CurrPage->m_TitleStringCtrl->GetValue(); wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() ) if( title.IsEmpty() )
DisplayInfoMessage( this, 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 ) ...@@ -436,7 +437,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
/** Function GenNetlist /** Function GenNetlist
* Create the netlist file: * Create the netlist file:
* calcualte the filename with the suitable extentions * calculate the filename with the suitable extensions
* and run the netlist creator * and run the netlist creator
*/ */
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -12,9 +12,9 @@ class SCH_COMPONENT; ...@@ -12,9 +12,9 @@ class SCH_COMPONENT;
class BASE_SCREEN; class BASE_SCREEN;
class SCH_SCREEN; class SCH_SCREEN;
class SCH_ITEM; class SCH_ITEM;
class Hierarchical_PIN_Sheet_Struct; class SCH_SHEET_PIN;
class PLOTTER; class PLOTTER;
class DrawSheetStruct; class SCH_SHEET;
class LIB_PIN; class LIB_PIN;
...@@ -121,14 +121,13 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, ...@@ -121,14 +121,13 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
int SearchMask ); int SearchMask );
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos );
const wxPoint& pos );
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
const wxPoint& RefPos, const wxPoint& RefPos,
SCH_COMPONENT** libpart = NULL ); SCH_COMPONENT** libpart = NULL );
Hierarchical_PIN_Sheet_Struct* LocateAnyPinSheet( const wxPoint& RefPos, SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos,
SCH_ITEM* DrawList ); SCH_ITEM* DrawList );
/***************/ /***************/
...@@ -192,7 +191,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist ); ...@@ -192,7 +191,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
/***************/ /***************/
/* DELSHEET.CPP */ /* 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 ); bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->EEDrawList and the subhierarchies
......
This diff is collapsed.
This diff is collapsed.
...@@ -138,8 +138,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage ) ...@@ -138,8 +138,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (DrawSheetStruct*) aItem ) #define SOURCE ( (SCH_SHEET*) aItem )
#define DEST ( (DrawSheetStruct*) aImage ) #define DEST ( (SCH_SHEET*) aImage )
DEST->SwapData( SOURCE ); DEST->SwapData( SOURCE );
break; break;
...@@ -154,8 +154,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage ) ...@@ -154,8 +154,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ( (Hierarchical_PIN_Sheet_Struct*) aItem ) #define SOURCE ( (SCH_SHEET_PIN*) aItem )
#define DEST ( (Hierarchical_PIN_Sheet_Struct*) aImage ) #define DEST ( (SCH_SHEET_PIN*) aImage )
EXCHG( SOURCE->m_Edge, DEST->m_Edge ); EXCHG( SOURCE->m_Edge, DEST->m_Edge );
EXCHG( SOURCE->m_Shape, DEST->m_Shape ); EXCHG( SOURCE->m_Shape, DEST->m_Shape );
break; break;
......
This diff is collapsed.
This diff is collapsed.
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
/// Constructors /// Constructors
WinEDA_SheetPropertiesFrame( ); WinEDA_SheetPropertiesFrame( );
WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawSheetStruct * currentsheet, SCH_SHEET * currentsheet,
wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME, wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME,
const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE, const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION, const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION,
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
////@end WinEDA_SheetPropertiesFrame member variables ////@end WinEDA_SheetPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
DrawSheetStruct* m_CurrentSheet; SCH_SHEET* m_CurrentSheet;
}; };
#endif #endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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