7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 09:31:42 +00:00

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.
This commit is contained in:
stambaughw 2009-11-04 20:46:53 +00:00
parent a3f48bf241
commit b2f9d5bd74
66 changed files with 2701 additions and 2821 deletions

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_aux.cpp
/////////////////////////////////////////////////////////////////////////////
@ -23,9 +22,8 @@
#include "3d_viewer.h"
#include "trackball.h"
/**************************************************************************/
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/**************************************************************************/
{
int ii;
@ -39,13 +37,13 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/* adjust rotation */
if( m_MatRotation.x )
RotatePoint( &coord[ii].y, &coord[ii].z,
(int) (m_MatRotation.x * 10) );
(int) (m_MatRotation.x * 10) );
if( m_MatRotation.y )
RotatePoint( &coord[ii].z, &coord[ii].x,
(int) (m_MatRotation.y * 10) );
(int) (m_MatRotation.y * 10) );
if( m_MatRotation.z )
RotatePoint( &coord[ii].x, &coord[ii].y,
(int) (m_MatRotation.z * 10) );
(int) (m_MatRotation.z * 10) );
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
@ -55,9 +53,7 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
}
/************************************************************/
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
/************************************************************/
{
int ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
@ -106,17 +102,15 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
for( ii = 0; ii < nbcoord; ii++ )
{
glVertex3f( coord[ii].x * DataScale3D,
coord[ii].y * DataScale3D,
coord[ii].z * DataScale3D );
coord[ii].y * DataScale3D,
coord[ii].z * DataScale3D );
}
glEnd();
}
/**********************************************/
GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/**********************************************/
{
GLuint gllist = glGenLists( 1 );
@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/* class Info_3D_Visu */
/**********************/
/* Constructor */
Info_3D_Visu::Info_3D_Visu()
{
int ii;
@ -176,8 +169,8 @@ Info_3D_Visu::Info_3D_Visu()
m_Draw3DZone = TRUE;
m_Draw3DComments = TRUE;
m_Draw3DDrawings = TRUE;
m_Draw3DEco1 = TRUE;
m_Draw3DEco2 = TRUE;
m_Draw3DEco1 = TRUE;
m_Draw3DEco2 = TRUE;
}
@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu()
}
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer,
int units, int internal_unit )
@ -207,73 +197,63 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
text = title;
text += ReturnUnitSymbol( units );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize(
-1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition,
wxSize( -1, -1 ), 0 );
BoxSizer->Add( msgtitle, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM | wxADJUST_MINSIZE );
BoxSizer->Add(
msgtitle,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_XValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_XValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Y:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_YValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_YValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
GridSizer->Add( m_YValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Z:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_ZValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_ZValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
5 );
GridSizer->Add( m_ZValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
}
@ -282,12 +262,8 @@ WinEDA_VertexCtrl::~WinEDA_VertexCtrl()
}
/*******************************************/
/* Returns (in internal units) to coordinate between (in user units) */
S3D_Vertex WinEDA_VertexCtrl::GetValue()
/*******************************************/
/* Retourne (en unites internes) les coordonnes entrees (en unites utilisateur)
*/
{
S3D_Vertex value;
double dtmp;
@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue()
}
/**************************************************/
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
/**************************************************/
{
wxString text;
@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
}
/*****************************************/
void WinEDA_VertexCtrl::Enable( bool onoff )
/*****************************************/
{
m_XValueCtrl->Enable( onoff );
m_YValueCtrl->Enable( onoff );

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_canvas.cpp
/////////////////////////////////////////////////////////////////////////////
@ -35,39 +34,38 @@
*/
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
Pcb3D_GLCanvas::OnPopUpMenu )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
Pcb3D_GLCanvas::OnPopUpMenu )
END_EVENT_TABLE()
/*************************************************************************/
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#else
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#endif
/*************************************************************************/
{
m_init = FALSE;
m_gllist = 0;
m_Parent = parent;
#if wxCHECK_VERSION( 2, 9, 0 )
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext(this);
m_glRC = new wxGLContext( this );
#endif
DisplayStatus();
}
/*************************************/
Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
/*************************************/
{
ClearLists();
m_init = FALSE;
@ -77,9 +75,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
}
/*************************************/
void Pcb3D_GLCanvas::ClearLists()
/*************************************/
{
if( m_gllist > 0 )
glDeleteLists( m_gllist, 1 );
@ -87,18 +83,14 @@ void Pcb3D_GLCanvas::ClearLists()
}
/*********************************************/
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event )
/*********************************************/
{
SetView3D( event.GetKeyCode() );
event.Skip();
}
/*********************************************/
void Pcb3D_GLCanvas::SetView3D( int keycode )
/*********************************************/
{
int ii;
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
@ -214,9 +206,7 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
}
/********************************************************/
void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
/********************************************************/
{
wxSize size( GetClientSize() );
double spin_quat[4];
@ -286,10 +276,14 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
else if( event.MiddleIsDown() )
{
/* middle button drag -> pan */
/* Current zoom and an additional factor are taken into account for the amount of panning. */
/* Current zoom and an additional factor are taken into account
* for the amount of panning. */
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
g_Draw3d_dx -= PAN_FACTOR * ( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
g_Draw3d_dy -= PAN_FACTOR * (event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
g_Draw3d_dx -= PAN_FACTOR *
( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
g_Draw3d_dy -= PAN_FACTOR *
(event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
}
/* orientation has changed, redraw mesh */
@ -302,80 +296,76 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
/*******************************************************/
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
* de la souris
/* Construct and display a popup menu when the right button is clicked.
*/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu PopUpMenu;
pos.x = event.GetX(); pos.y = event.GetY();
wxMenuItem* item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
_( "Zoom +" ) );
_( "Zoom +" ) );
item->SetBitmap( zoom_in_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
_( "Zoom -" ) );
_( "Zoom -" ) );
item->SetBitmap( zoom_out_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
_( "Top View" ) );
_( "Top View" ) );
item->SetBitmap( axis3d_top_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
_( "Bottom View" ) );
_( "Bottom View" ) );
item->SetBitmap( axis3d_bottom_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
_( "Right View" ) );
_( "Right View" ) );
item->SetBitmap( axis3d_right_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
_( "Left View" ) );
_( "Left View" ) );
item->SetBitmap( axis3d_left_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
_( "Front View" ) );
_( "Front View" ) );
item->SetBitmap( axis3d_front_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
_( "Back View" ) );
_( "Back View" ) );
item->SetBitmap( axis3d_back_xpm );
PopUpMenu.Append( item );
PopUpMenu.AppendSeparator();
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
_( "Move left <-" ) );
_( "Move left <-" ) );
item->SetBitmap( left_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
_( "Move right ->" ) );
_( "Move right ->" ) );
item->SetBitmap( right_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
_( "Move Up ^" ) );
_( "Move Up ^" ) );
item->SetBitmap( up_xpm );
PopUpMenu.Append( item );
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
_( "Move Down" ) );
_( "Move Down" ) );
item->SetBitmap( down_xpm );
PopUpMenu.Append( item );
@ -383,9 +373,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
/*******************************************************/
{
int key = 0;
@ -447,9 +435,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
}
/***************************************/
void Pcb3D_GLCanvas::DisplayStatus()
/***************************************/
{
wxString msg;
@ -464,30 +450,23 @@ void Pcb3D_GLCanvas::DisplayStatus()
}
/*************************************************/
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/
{
wxPaintDC dc( this );
Redraw();
event.Skip();
}
/***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
/***********************************************************/
{
// Do nothing, to avoid flashing.
}
/****************************/
/* Initialize broad parameters for OpenGL */
void Pcb3D_GLCanvas::InitGL()
/****************************/
/* Int parametres generaux pour OPENGL
*/
{
wxSize size = GetClientSize();
@ -517,7 +496,9 @@ void Pcb3D_GLCanvas::InitGL()
}
/* set viewing projection */
double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage
// Ratio width / height of the window display
double ratio_HV = (double) size.x / size.y;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
@ -541,17 +522,11 @@ void Pcb3D_GLCanvas::InitGL()
/* Setup light souces: */
SetLights();
}
/***********************************/
/* Initialize OpenGL light sources. */
void Pcb3D_GLCanvas::SetLights()
/***********************************/
/* Init sources lumineuses pour OPENGL
*/
{
double light;
GLfloat light_color[4];
@ -576,13 +551,10 @@ void Pcb3D_GLCanvas::SetLights()
}
/**********************************************************/
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
/**********************************************************/
/* Create a Screenshot of the current 3D view.
* Output file format is png or jpeg, or image is copied on clipboard
*/
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
{
wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
wxString FullFileName;
@ -599,15 +571,10 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
fn.SetExt( file_ext );
FullFileName =
EDA_FileSelector( _( "3D Image filename:" ),
wxEmptyString, /* Chemin par defaut */
fn.GetFullName(), /* nom fichier par defaut */
file_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString,
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
if( FullFileName.IsEmpty() )
return;
}
@ -630,8 +597,9 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
{
if( !wxTheClipboard->SetData( dobjBmp ) )
wxLogError( _T( "Failed to copy image to clipboard" ) );
wxTheClipboard->Flush(); /* the data on clipboard
* will stay available after the application exits */
wxTheClipboard->Flush(); /* the data in clipboard will stay
* available after the
* application exits */
wxTheClipboard->Close();
}
}
@ -640,7 +608,8 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
wxImage image = bitmap.ConvertToImage();
if( !image.SaveFile( FullFileName,
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG :
wxBITMAP_TYPE_PNG ) )
wxLogError( wxT( "Can't save file" ) );
image.Destroy();

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp
/////////////////////////////////////////////////////////////////////////////
@ -14,37 +13,31 @@
#include "3d_viewer.h"
/****************************/
S3D_Vertex::S3D_Vertex()
/****************************/
{
x = y = z = 0.0;
}
/**************************************************************************/
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED )
/**************************************************************************/
{
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
m_AmbientIntensity = 1.0;
m_Transparency = 0.0;
m_Shininess = 1.0;
m_Transparency = 0.0;
m_Shininess = 1.0;
m_Name = name;
}
/***********************************/
void S3D_MATERIAL::SetMaterial()
/***********************************/
{
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency );
m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency );
#if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial()
}
/****************************************************/
void S3D_MASTER::Copy( S3D_MASTER* pattern )
/****************************************************/
{
m_Shape3DName = pattern->m_Shape3DName;
m_MatScale = pattern->m_MatScale;
@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
}
/***************************************************************/
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL;
@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
}
/***************************************/
S3D_MASTER:: ~S3D_MASTER()
/***************************************/
{
Struct3D_Shape* next;
S3D_MATERIAL* nextmat;
@ -90,7 +77,7 @@ S3D_MASTER:: ~S3D_MASTER()
delete m_3D_Drawings;
}
for( ; m_Materials != NULL; m_Materials = nextmat )
for( ; m_Materials != NULL; m_Materials = nextmat )
{
nextmat = m_Materials->Next();
delete m_Materials;
@ -98,20 +85,16 @@ S3D_MASTER:: ~S3D_MASTER()
}
/***************************************************************/
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_3D_Coord = NULL;
m_3D_Coord = NULL;
m_3D_CoordIndex = NULL;
m_3D_Points = 0;
}
/***************************************/
Struct3D_Shape:: ~Struct3D_Shape()
/***************************************/
{
delete m_3D_Coord;
delete m_3D_CoordIndex;

View File

@ -19,36 +19,32 @@
#endif
static void Draw3D_FilledCircle( double posx, double posy,
double rayon, double hole_rayon, double zpos );
static void Draw3D_FilledCircle( double posx, double posy, double rayon,
double hole_rayon, double zpos );
static void Draw3D_FilledSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_FilledCylinder( double posx, double posy,
double rayon, double height, double zpos );
static void Draw3D_FilledSegmentWithHole( double startx,
double starty,
double endx,
double endy,
double width,
double holex,
double holey,
double holeradius,
double endx, double endy,
double width, double zpos );
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
double height, double zpos );
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
double endx, double endy,
double width, double holex,
double holey, double holeradius,
double zpos );
static void Draw3D_ArcSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_CircleSegment( double startx, double starty,
double endx, double endy, double width, double zpos );
static void Draw3D_ArcSegment( double startx, double starty, double endx,
double endy, double width, double zpos );
static void Draw3D_CircleSegment( double startx, double starty, double endx,
double endy, double width, double zpos );
static int Get3DLayerEnable( int act_layer );
static GLfloat Get3DLayerSide( int act_layer );
/******************************************/
void Pcb3D_GLCanvas::Redraw( bool finish )
/******************************************/
{
#if wxCHECK_VERSION( 2, 9, 0 )
SetCurrent(*m_glRC);
SetCurrent( *m_glRC );
#else
SetCurrent( );
SetCurrent();
#endif
// Set the OpenGL viewport according to the client size of this canvas.
@ -68,7 +64,7 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
/* transformations */
GLfloat mat[4][4];
// Translatory motion first, so rotations don't mess up the orientation...
// Translate motion first, so rotations don't mess up the orientation...
glTranslatef( g_Draw3d_dx, g_Draw3d_dy, 0.0F );
build_rotmatrix( mat, g_Parm_3D_Visu.m_Quat );
@ -92,20 +88,17 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
}
/**********************************************/
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
/**********************************************/
/* Create the draw list items
*/
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
{
WinEDA_BasePcbFrame* pcbframe = m_Parent->m_Parent;
BOARD* pcb = pcbframe->GetBoard();
TRACK* track;
SEGZONE* segzone;
SEGZONE* segzone;
int ii;
wxBusyCursor dummy;
wxBusyCursor dummy;
m_gllist = glGenLists( 1 );
@ -116,15 +109,17 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find a *really* single side board in the true life...
if ( g_Parm_3D_Visu.m_Layers < 2 )
// Ensure the board has 2 sides for 3D views, because it is hard to find
// a *really* single side board in the true life...
if( g_Parm_3D_Visu.m_Layers < 2 )
g_Parm_3D_Visu.m_Layers = 2;
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
g_Parm_3D_Visu.m_BoardSize.y );
// @TODO: epoxy_width (board thickness) must be set by user,
// because all boards thickness no not match with this setup:
//double epoxy_width = 1.6; // epoxy width in mm
// double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness
* g_Parm_3D_Visu.m_BoardScale;
@ -133,8 +128,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
for( ii = 0; ii < 32; ii++ )
{
if( ii < g_Parm_3D_Visu.m_Layers )
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width * ii
/ (g_Parm_3D_Visu.m_Layers - 1);
g_Parm_3D_Visu.m_LayerZcoord[ii] =
g_Parm_3D_Visu.m_Epoxy_Width
* ii / (g_Parm_3D_Visu.m_Layers - 1);
else
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
}
@ -160,14 +156,14 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
glEnable( GL_COLOR_MATERIAL );
SetGLColor( WHITE );
glBegin( GL_LINES );
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
glEnd();
}
@ -204,7 +200,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
glEnd();
#endif
/* move the board in order to draw it with its centre at 0,0 3D coordinates */
/* move the board in order to draw it with its center at 0,0 3D
* coordinates */
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale,
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
0.0F );
@ -239,24 +236,27 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
int imax = zone->m_FilledPolysList.size() - 1;
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
CPolyPt* begincorner = firstcorner;
SEGZONE dummysegment(pcb);
SEGZONE dummysegment( pcb );
dummysegment.SetLayer( zone->GetLayer() );
dummysegment.m_Width = zone->m_ZoneMinThickness;
dummysegment.m_Width = zone->m_ZoneMinThickness;
for( int ic = 1; ic <= imax; ic++ )
{
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments
if( begincorner->utility == 0 )
{
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = begincorner->x;
dummysegment.m_Start.y = begincorner->y;
dummysegment.m_End.x = endcorner->x;
dummysegment.m_End.y = endcorner->y;
Draw3D_Track( &dummysegment );
}
if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
if( (endcorner->end_contour) || (ic == imax) )
{
if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments
// the last corner of a filled area is found: draw it
if( endcorner->utility == 0 )
{
// Draw only basic outlines, not extra segments
dummysegment.m_Start.x = endcorner->x;
dummysegment.m_Start.y = endcorner->y;
dummysegment.m_End.x = firstcorner->x;
@ -266,18 +266,20 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
}
ic++;
if( ic < imax - 1 )
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
begincorner = firstcorner =
&zone->m_FilledPolysList[ic];
}
else
begincorner = endcorner;
}
}
}
/* draw graphic items */
EDA_BaseStruct* PtStruct;
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( PtStruct = pcb->m_Drawings;
PtStruct != NULL;
PtStruct = PtStruct->Next() )
{
switch( PtStruct->Type() )
{
@ -311,9 +313,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
}
/************************************************/
void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
/************************************************/
{
double zpos;
int layer = track->GetLayer();
@ -323,7 +323,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( layer == LAST_COPPER_LAYER )
layer = g_Parm_3D_Visu.m_Layers - 1;
@ -341,12 +341,9 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
}
/********************************************/
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
/*********************************************/
/* 3D drawing for a VIA (cylinder + filled circles)
*/
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
{
double x, y, r, hole;
int layer, top_layer, bottom_layer;
@ -367,13 +364,15 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
}
else
{
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) ==
false )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
}
@ -394,14 +393,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
// Drawing hole:
color = g_Parm_3D_Visu.m_BoardSettings->m_ViaColor[via->m_Shape];
SetGLColor( color );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
Draw3D_FilledCylinder( x, -y, hole, height, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
Draw3D_FilledCylinder( x, -y, hole, height,
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
}
/*************************************************************/
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
/*************************************************************/
{
double x, y, xf, yf;
double zpos, w;
@ -411,7 +410,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
SetGLColor( color );
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
@ -490,9 +489,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
}
/*************************************************************/
void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
/*************************************************************/
{
int layer = text->GetLayer();
@ -508,7 +505,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
wxSize size = text->m_Size;
if( text->m_Mirror )
NEGATE(size.x);
NEGATE( size.x );
if( text->m_MultilineAllowed )
{
wxPoint pos = text->m_Pos;
@ -522,11 +519,10 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
{
wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
txt, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
txt, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true, Draw3dTextSegm );
pos += offset;
}
@ -534,17 +530,15 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
}
else
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
text->m_Text, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
text->m_Text, text->m_Orient, size,
text->m_HJustify, text->m_VJustify,
text->m_Width, text->m_Italic,
true,
Draw3dTextSegm );
}
/*********************************************/
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/*********************************************/
{
D_PAD* pad = m_Pads;
@ -603,8 +597,9 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
glPopMatrix();
}
if( !As3dShape ) // The footprint does not have a 3D shape, draw its 2D shape instead
if( !As3dShape )
{
// The footprint does not have a 3D shape, draw its 2D shape instead
EDA_BaseStruct* Struct = m_Drawings;
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
for( ; Struct != NULL; Struct = Struct->Next() )
@ -626,9 +621,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
}
/***************************************************/
void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/***************************************************/
{
wxString s;
int dx, dy;
@ -637,7 +630,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
return;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
SetGLColor( color );
@ -670,18 +663,14 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
default:
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
D(printf( "%s", CONV_TO_UTF8( s ) );)
D( printf( "%s", CONV_TO_UTF8( s ) ); )
break;
}
}
/***********************************************/
/* Draw 3D pads. */
void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
/***********************************************/
/* Dessin 3D des pads avec leur trou de percage
*/
{
int ii, ll, layer, nlmax;
int ux0, uy0,
@ -704,20 +693,20 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
holeY = (double) m_Drill.y * scale / 2;
hole = MIN( holeX, holeY );
/* calcul du centre des formes des pads : */
/* Calculate the center of the pad. */
shape_pos = ReturnShapePos();
ux0 = shape_pos.x;
uy0 = shape_pos.y;
xc = ux0;
yc = uy0;
/* le trace depend de la rotation de l'empreinte */
dx = dx0 = m_Size.x >> 1;
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
dy = dy0 = m_Size.y >> 1;
angle = m_Orient;
drillx = m_Pos.x * scale;
drilly = m_Pos.y * scale;
/* Draw the pad hole (TODO: draw OBLONG hole) */
if( holeX && holeY )
{
@ -746,10 +735,12 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
@ -765,15 +756,14 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
break;
case PAD_OVAL:
/* calcul de l'entraxe de l'ellipse */
if( dx > dy ) /* ellipse horizontale */
if( dx > dy ) /* Horizontal ellipse */
{
delta_cx = dx - dy;
delta_cy = 0;
w = m_Size.y * scale;
delta_angle = angle + 900;
}
else /* ellipse verticale */
else /* Vertical ellipse */
{
delta_cx = 0;
delta_cy = dy - dx;
@ -787,7 +777,9 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
oy = (double) ( uy0 + delta_cy ) * scale;
fx = (double) ( ux0 - delta_cx ) * scale;
fy = (double) ( uy0 - delta_cy ) * scale;
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
for( layer = FIRST_COPPER_LAYER;
layer <= LAST_COPPER_LAYER;
layer++ )
{
if( layer && (layer == nlmax) )
layer = CMP_N;
@ -795,11 +787,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER)
&& (layer < LAST_COPPER_LAYER) && !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
@ -808,7 +802,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
else
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos );
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx,
-drilly, hole, zpos );
}
}
break;
@ -819,7 +814,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
{
int ddx, ddy;
ddx = m_DeltaSize.x >> 1;
ddy = m_DeltaSize.y >> 1; /* demi dim dx et dy */
ddy = m_DeltaSize.y >> 1;
coord[0][0] = -dx - ddy;
coord[0][1] = +dy + ddx;
@ -839,8 +834,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
coord[ii][0] += ux0;
coord[ii][1] += uy0;
ll = ii * 2;
fcoord[ll][0] = coord[ii][0] *scale;
fcoord[ll][1] = coord[ii][1] *scale;
fcoord[ll][0] = coord[ii][0] * scale;
fcoord[ll][1] = coord[ii][1] * scale;
}
for( ii = 0; ii < 7; ii += 2 )
@ -870,11 +865,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
continue;
if( (layer == COPPER_LAYER_N) && !Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
&& !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
false )
continue;
SetGLColor( color );
@ -903,9 +900,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
}
/*************************/
void SetGLColor( int color )
/*************************/
{
double red, green, blue;
StructColors colordata = ColorRefs[color & MASKCOLOR];
@ -917,10 +912,8 @@ void SetGLColor( int color )
}
/********************************************************/
static void Draw3D_FilledCircle( double posx, double posy,
double rayon, double hole, double zpos )
/********************************************************/
{
int ii, slice = 16;
double x, y;
@ -942,10 +935,8 @@ static void Draw3D_FilledCircle( double posx, double posy,
}
/*********************************************************/
static void Draw3D_FilledCylinder( double posx, double posy,
double rayon, double height, double zpos )
/*********************************************************/
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
double height, double zpos )
{
int ii;
double x, y;
@ -954,7 +945,7 @@ static void Draw3D_FilledCylinder( double posx, double posy,
S3D_Vertex coords[4];
double tmp = DataScale3D;
DataScale3D = 1.0; // les coord sont deja a l'echelle pour Set_Object_Data();
DataScale3D = 1.0; // Coordinate is already in range for Set_Object_Data();
coords[0].x = coords[1].x = posx + rayon;
coords[0].y = coords[1].y = posy;
coords[0].z = coords[3].z = zpos;
@ -979,31 +970,25 @@ static void Draw3D_FilledCylinder( double posx, double posy,
}
/*****************************************************************/
static void Draw3D_FilledSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds
*/
/* Draw a polygon similar to a segment has rounded tips */
static void Draw3D_FilledSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
double dx, dy, x, y, firstx = 0, firsty = 0;
int ii, angle;
// on va calculer les coordonnées du segment supposé horizontal,
// puis tourner les cordonnes de l'angle voulu
// Calculate the coordinates of the segment assumed horizontal.
// Then turn the strips of the desired angle.
dx = endx - startx;
dy = endy - starty;
angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 );
RotatePoint( &dx, &dy, angle ); // apres rotation: dx = longueur du segment
// dy = 0;
RotatePoint( &dx, &dy, angle );
width /= 2;
glBegin( GL_POLYGON );
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
// Trace the flare to right (1st half polygon at the end of the segment)
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0;
@ -1019,7 +1004,7 @@ static void Draw3D_FilledSegment( double startx, double starty,
}
}
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// Rounding the left (2nd half polygon is the origin of the segment)
for( ii = 0; ii <= 8; ii++ )
{
int jj = ii * 225;
@ -1034,44 +1019,35 @@ static void Draw3D_FilledSegment( double startx, double starty,
}
/*****************************************************************/
static void Draw3D_FilledSegmentWithHole( double startx,
double starty,
double endx,
double endy,
double width,
double holex,
double holey,
double holeradius,
double zpos )
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds avec trou
/* Draw a polygon similar to a segment ends with round hole
*/
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
double endx, double endy,
double width, double holex,
double holey, double holeradius,
double zpos )
{
double x, y, xin, yin;
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
int ii, angle, theta;
// on va calculer les coordonnées du segment supposé horizontal,
// puis tourner les cordonnes de l'angle voulu
// Tous des calculs se font avec startx, starty comme origine du tracé
// Calculate the coordinates of the segment assumed horizontal
// Then turn the strips of the desired angle
// All calculations are done with startx, starty as the origin of the route
endx -= startx;
endy -= starty;
holex -= startx;
holey -= starty;
angle = (int) ( ( atan2( endy, endx ) * 1800 / M_PI ) + 0.5 );
RotatePoint( &endx, &endy, angle ); // apres rotation: endx = longueur du segment
// endy = 0;
RotatePoint( &endx, &endy, angle );
RotatePoint( &holex, &holey, angle );
width /= 2;
glBegin( GL_QUAD_STRIP );
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
// autour du demi-trou de percage
// Path of the flare to right (1st half polygon at the end of the segment)
// around the half-hole drilling
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0;
@ -1087,7 +1063,7 @@ static void Draw3D_FilledSegmentWithHole( double startx,
RotatePoint( &xin, &yin, -angle );
glVertex3f( startx + xin, starty + yin, zpos );
glVertex3f( startx + x, starty + y, zpos );
if( ii == 0 ) // Memorisation du point de départ du tracé
if( ii == 0 )
{
firstx = startx + x;
firsty = starty + y;
@ -1096,7 +1072,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
}
}
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// Layout of the rounded left (2nd half polygon is the origin of the
// segment)
for( ii = 0; ii <= 8; ii++ )
{
theta = -ii * 225;
@ -1118,15 +1095,15 @@ static void Draw3D_FilledSegmentWithHole( double startx,
}
/********************************************************/
static void Draw3D_ArcSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
static void Draw3D_ArcSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
int ii, slice = 36;
double x, y, hole, rayon;
int angle;
angle = static_cast<int>(atan2( startx - endx, starty - endy ) * 1800 / M_PI) + 900;
angle = static_cast<int>( atan2( startx - endx, starty - endy ) *
1800 / M_PI ) + 900;
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
hole = rayon - width;
@ -1134,10 +1111,10 @@ static void Draw3D_ArcSegment( double startx, double starty,
for( ii = 0; ii <= slice / 4; ii++ )
{
x = hole; y = 0.0;
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
glVertex3f( x + startx, y + starty, zpos );
x = rayon; y = 0.0;
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
glVertex3f( x + startx, y + starty, zpos );
}
@ -1145,10 +1122,8 @@ static void Draw3D_ArcSegment( double startx, double starty,
}
/*******************************************************************/
static void Draw3D_CircleSegment( double startx, double starty,
double endx, double endy, double width, double zpos )
/*******************************************************************/
static void Draw3D_CircleSegment( double startx, double starty, double endx,
double endy, double width, double zpos )
{
int ii, slice = 36;
double x, y, hole, rayon;
@ -1171,9 +1146,7 @@ static void Draw3D_CircleSegment( double startx, double starty,
}
/******************************************/
static int Get3DLayerEnable( int act_layer )
/******************************************/
{
bool enablelayer;
@ -1191,20 +1164,16 @@ static int Get3DLayerEnable( int act_layer )
}
/******************************************/
static GLfloat Get3DLayerSide( int act_layer )
/******************************************/
{
GLfloat nZ;
nZ = 1.0;
if(
(act_layer <= LAST_COPPER_LAYER - 1)
|| (act_layer == ADHESIVE_N_CU)
|| (act_layer == SOLDERPASTE_N_CU)
|| (act_layer == SILKSCREEN_N_CU)
|| (act_layer == SOLDERMASK_N_CU)
)
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|| ( act_layer == ADHESIVE_N_CU )
|| ( act_layer == SOLDERPASTE_N_CU )
|| ( act_layer == SILKSCREEN_N_CU )
|| ( act_layer == SOLDERMASK_N_CU ) )
nZ = -1.0;
return nZ;
}

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_frame.cpp
/////////////////////////////////////////////////////////////////////////////
@ -26,11 +25,11 @@
#include <wxstruct.h>
Info_3D_Visu g_Parm_3D_Visu;
double g_Draw3d_dx;
double g_Draw3d_dy;
double ZBottom;
double ZTop;
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
double g_Draw3d_dx;
double g_Draw3d_dy;
double ZBottom;
double ZTop;
double DataScale3D; // 3D conversion units.
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title,
wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
/*******************************************************************/
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ),
wxSize( -1, -1 ), style )
{
m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL;
m_Parent = parent;
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
m_InternalUnits = 10000; // Internal units = 1/10000 inch
// Give it an icon
SetIcon( wxICON( icon_w3d ) );
@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
// Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas( this );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
wxAuiPaneInfo vert(horiz);
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top());
m_auimgr.AddPane(m_Canvas,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane( m_Canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.Update();
#endif
}
/***********************************************************/
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
/***********************************************************/
{
Close( TRUE );
}
/***********************************************************/
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/
{
SaveSettings();
if( m_Parent )
@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
}
/******************************************/
void WinEDA3D_DrawFrame::GetSettings()
/******************************************/
{
wxString text;
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by
// application
if( config )
{
@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings()
}
/*******************************************/
void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/
{
wxString text;
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by
// application
if( !Config )
return;
@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
}
/***********************************************************/
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
/***********************************************************/
{
int ii;
@ -231,40 +221,29 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
}
/************************************************************************/
void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/
{
}
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
}
/************************************/
int WinEDA3D_DrawFrame::BestZoom()
/************************************/
// Retourne le meilleur zoom
{
return 1;
}
/*******************************************************************/
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
{
}
/************************************************************************/
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
/************************************************************************/
{
#define ROT_ANGLE 10.0
@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
return;
default:
wxMessageBox(
wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) );
wxMessageBox( wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() \
error: unknown command" ) );
return;
}
@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
}
/*****************************************/
void WinEDA3D_DrawFrame::NewDisplay()
/*****************************************/
{
m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List();
// m_Canvas->InitGL();
m_Canvas->Refresh( true );
m_Canvas->DisplayStatus();
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DBgColor()
/******************************************/
/* called to set the background color of the 3D scene
*/
void WinEDA3D_DrawFrame::Set3DBgColor()
{
S3D_Color color;
wxColour newcolor, oldcolor;
@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DAxisOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DAxis )
g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DModuleOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DModule )
g_Parm_3D_Visu.m_Draw3DModule = FALSE;
@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DZoneOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DZone )
g_Parm_3D_Visu.m_Draw3DZone = FALSE;
@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DComments )
g_Parm_3D_Visu.m_Draw3DComments = FALSE;
@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DDrawings )
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco1OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco1 )
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco2OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco2 )
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;

View File

@ -1,5 +1,4 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_read_mesh.cpp
/////////////////////////////////////////////////////////////////////////////
@ -18,9 +17,7 @@
#include "3d_viewer.h"
/***********************************/
int S3D_MASTER:: ReadData()
/************************************/
int S3D_MASTER::ReadData()
{
char line[1024], * text;
wxFileName fn;
@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData()
}
if( wxFileName::FileExists(m_Shape3DName) )
if( wxFileName::FileExists( m_Shape3DName ) )
FullFilename = m_Shape3DName;
else
{
@ -44,7 +41,7 @@ int S3D_MASTER:: ReadData()
if( FullFilename.IsEmpty() )
{
wxLogDebug( _( "3D part library <%s> could not be found." ),
GetChars( fn.GetFullPath() ) );
GetChars( fn.GetFullPath() ) );
return -1;
}
}
@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData()
return -1;
}
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard( );
// Switch the locale to standard C (needed to print floating point
// numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
@ -79,40 +77,36 @@ int S3D_MASTER:: ReadData()
}
fclose( file );
SetLocaleTo_Default( ); // revert to the current locale
SetLocaleTo_Default(); // revert to the current locale
return 0;
}
/*********************************************************/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
/*********************************************************/
/*
* analyse la description du type:
* material DEF yellow Material {
* diffuseColor 1.00000 1.00000 0.00000e+0
* emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0
* specularColor 1.00000 1.00000 1.00000
* ambientIntensity 1.00000
* transparency 0.00000e+0
* shininess 1.00000
* }
* ou du type:
* material USE yellow
* Analyzes the description of the type:
* DEF yellow material Material (
* DiffuseColor 1.00000 1.00000 0.00000e 0
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* SpecularColor 1.00000 1.00000 1.00000
* AmbientIntensity 1.00000
* Transparency 0.00000e 0
* Shininess 1.00000
*)
* Or type:
* USE yellow material
*/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
{
char line[512], * text, * command;
wxString mat_name;
S3D_MATERIAL* material = NULL;
// Lecture de la commande:
command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" );
mat_name = CONV_FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 )
{
for( material = m_Materials; material; material = material->Next() )
for( material = m_Materials; material; material = material->Next() )
{
if( material->m_Name == mat_name )
{
@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
}
/**********************************************************/
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
/***********************************************************/
{
char line[1024], * text;
@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
}
/********************************************************/
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
/********************************************************/
{
char line[1024], * text;
int err = 1;
@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
}
/*************************************************************/
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
/*************************************************************/
{
char line[1024], * text;
int err = 1;
@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
#define BUFSIZE 2000
/************************************************************************************/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
/************************************************************************************/
/* Read a coordinate liste like:
/* Read a coordinate list like:
* coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2,
* -5.11821 6.57421e-3 0.542654,
@ -305,6 +289,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
* text_buffer contains the first line of this node :
* "coord Coordinate { point ["
*/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
int* LineNum )
{
double* data_list = NULL;
unsigned int ii = 0, jj = 0, nn = BUFSIZE;
@ -351,7 +337,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
if( ii >= nn )
{
nn *= 2;
data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) );
data_list =
(double*) realloc( data_list, ( nn * sizeof(double) ) );
}
HasData = FALSE;
if( *text == ']' )
@ -384,9 +371,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
}
/***********************************************************/
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
/***********************************************************/
{
char line[1024], buffer[1024], * text;
int err = 1;
@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normal" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "color" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
/*********************************************************/
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
/*********************************************************/
{
char line[512];

View File

@ -1,37 +1,37 @@
/********************************************************/
/* 3d_struct.h : definition des structures de donnees */
/* pour la representation 3D des modules */
/********************************************************/
/*****************/
/* 3d_struct.h */
/*****************/
#ifndef STRUCT_3D_H
#define STRUCT_3D_H
#include "base_struct.h"
/* 3D modeler units -> PCB units conversion scale:
* 1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */
/* 3D modeling units -> PCB units conversion scale:
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch
*/
#define UNITS3D_TO_UNITSPCB 1000
class S3D_MASTER;
class Struct3D_Shape;
class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/
class S3D_Color /* 3D color (R, G, G) 3 floats range 0 to 1.0*/
{
public:
double m_Red, m_Green, m_Blue;
public:
S3D_Color() {
public: S3D_Color()
{
m_Red = m_Green = m_Blue = 0;
}
};
class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/
class S3D_Vertex /* 3D coordinate (3 float numbers: x,y,z coordinates)*/
{
public:
double x, y, z;
public:
S3D_Vertex();
public: S3D_Vertex();
};
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
@ -45,8 +45,7 @@ public:
float m_Transparency;
float m_Shininess;
public:
S3D_MATERIAL( S3D_MASTER * father, const wxString &name );
public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
@ -55,10 +54,8 @@ public:
};
/*******************************************/
class S3D_MASTER : public EDA_BaseStruct
/*******************************************/
/* Master structure for a 3D item description */
class S3D_MASTER : public EDA_BaseStruct
{
public:
wxString m_Shape3DName; /* 3D shape name in 3D library */
@ -68,9 +65,7 @@ public:
Struct3D_Shape* m_3D_Drawings;
S3D_MATERIAL* m_Materials;
public:
S3D_MASTER( EDA_BaseStruct * aParent );
public: S3D_MASTER( EDA_BaseStruct* aParent );
~S3D_MASTER();
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
@ -82,30 +77,27 @@ public:
m_Materials = aMaterial;
}
void Copy( S3D_MASTER* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
void Copy( S3D_MASTER* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
};
/*********************************************/
/* Describes a complex 3D */
class Struct3D_Shape : public EDA_BaseStruct
/*********************************************/
/* decrit une forme complexe 3D */
{
public:
S3D_Vertex* m_3D_Coord;
int* m_3D_CoordIndex;
int m_3D_Points;
public:
Struct3D_Shape( EDA_BaseStruct * aParent );
public: Struct3D_Shape( EDA_BaseStruct* aParent );
~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
@ -115,14 +107,11 @@ public:
};
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units.
* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
*/
class WinEDA_VertexCtrl
{
@ -133,18 +122,15 @@ private:
wxStaticText* m_Text;
public:
// Constructor and destructor
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
wxBoxSizer * BoxSizer,
int units, int internal_unit );
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, int units, int internal_unit );
~WinEDA_VertexCtrl();
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
};

View File

@ -1,6 +1,6 @@
/*******************************************************************/
/* 3d_toolbar.cpp: construction des tool bars de la frame visu 3d */
/*******************************************************************/
/********************/
/* 3d_toolbar.cpp */
/********************/
#include "fctsys.h"
#include "macros.h"
@ -9,31 +9,34 @@
#include "3d_viewer.h"
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateHToolbar()
/*********************************************/
{
if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens
{
// Simple update to the list of old files.
SetToolbars();
return;
}
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !KICAD_AUIMANAGER
SetToolBar( (wxToolBar*)m_HToolBar );
SetToolBar( (wxToolBar*) m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
wxBitmap( import3d_xpm ),
_( "Reload board" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__)) // do not work properly under linux
m_HToolBar-> AddSeparator();
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
wxBitmap( copy_button ),
_( "Copy 3D Image to Clipboard" ) );
_( "Copy 3D Image to Clipboard" ) );
#endif
m_HToolBar->AddSeparator();
@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
_( "Move right ->" ) );
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
_( "Move Up ^" ) );
_( "Move up ^" ) );
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
_( "Move Down" ) );
_( "Move down" ) );
m_HToolBar->Realize();
// SetToolbars();
}
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateVToolbar()
/*********************************************/
{
}
/**********************************************/
void WinEDA3D_DrawFrame::ReCreateMenuBar()
/**********************************************/
{
bool full_options = true;
bool full_options = true;
// If called from the display frame of cvpcb, only some options are relevant
if ( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all options
// If called from the display frame of cvpcb, only some options are
// relevant
if( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all
// options
wxMenuBar* menuBar = new wxMenuBar;
@ -119,8 +118,10 @@ bool full_options = true;
menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG,
_( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ) );
fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
@ -133,33 +134,31 @@ bool full_options = true;
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), axis3d_front_xpm );
if ( full_options )
if( full_options )
{
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), add_zone_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
_( "Zone Filling On/Off" ), add_zone_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), edit_sheet_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Comments Layer On/Off" ), edit_sheet_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), add_polygon_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
_( "Drawings Layer On/Off" ), add_polygon_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), tools_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
_( "Eco1 Layer On/Off" ), tools_xpm );
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), tools_xpm );
}
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
_( "Eco2 Layer On/Off" ), tools_xpm );
}
SetMenuBar( menuBar );
}
/*****************************************/
void WinEDA3D_DrawFrame::SetToolbars()
/*****************************************/
{
}

View File

@ -26,10 +26,10 @@
#include "id.h"
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
#define LIB3D_PATH wxT("packages3d")
#define LIB3D_PATH wxT( "packages3d" )
/**
* Command IDs for the 3D viewer.
@ -100,104 +100,106 @@ class SEGVIA;
class Info_3D_Visu
{
public:
double m_Beginx, m_Beginy; /* position of mouse */
double m_Quat[4]; /* orientation of object */
double m_Rot[4]; /* man rotation of object */
double m_Zoom; /* field of view in degrees */
double m_Beginx, m_Beginy; /* position of mouse */
double m_Quat[4]; /* orientation of object */
double m_Rot[4]; /* man rotation of object */
double m_Zoom; /* field of view in degrees */
S3D_Color m_BgColor;
bool m_Draw3DAxis;
bool m_Draw3DModule;
bool m_Draw3DZone;
bool m_Draw3DComments;
bool m_Draw3DDrawings;
bool m_Draw3DEco1;
bool m_Draw3DEco2;
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_Layers;
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
bool m_Draw3DAxis;
bool m_Draw3DModule;
bool m_Draw3DZone;
bool m_Draw3DComments;
bool m_Draw3DDrawings;
bool m_Draw3DEco1;
bool m_Draw3DEco2;
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_Layers;
EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design
// settings
double m_Epoxy_Width; /* Epoxy thickness (normalized)
**/
double m_BoardScale; /* Normalisation scale for coordinates:
when scaled tey are between -1.0 and +1.0 */
double m_LayerZcoord[32];
public:
Info_3D_Visu();
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[32];
public: Info_3D_Visu();
~Info_3D_Visu();
};
class Pcb3D_GLCanvas: public wxGLCanvas
class Pcb3D_GLCanvas : public wxGLCanvas
{
public:
WinEDA3D_DrawFrame * m_Parent;
WinEDA3D_DrawFrame* m_Parent;
private:
bool m_init;
GLuint m_gllist;
bool m_init;
GLuint m_gllist;
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLContext* m_glRC;
#endif
public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );
Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
~Pcb3D_GLCanvas();
void ClearLists();
void ClearLists();
void OnPaint(wxPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnRightClick(wxMouseEvent& event);
void OnPopUpMenu(wxCommandEvent & event);
void TakeScreenshot(wxCommandEvent & event);
void SetView3D(int keycode);
void DisplayStatus();
void Redraw(bool finish = false);
void OnPaint( wxPaintEvent& event );
void OnEraseBackground( wxEraseEvent& event );
void OnChar( wxKeyEvent& event );
void OnMouseEvent( wxMouseEvent& event );
void OnRightClick( wxMouseEvent& event );
void OnPopUpMenu( wxCommandEvent& event );
void TakeScreenshot( wxCommandEvent& event );
void SetView3D( int keycode );
void DisplayStatus();
void Redraw( bool finish = false );
GLuint DisplayCubeforTest();
void OnEnterWindow( wxMouseEvent& event );
void OnEnterWindow( wxMouseEvent& event );
void Render();
void Render();
GLuint CreateDrawGL_List();
void InitGL();
void SetLights();
void Draw3D_Track(TRACK * track);
void Draw3D_Via(SEGVIA * via);
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
void Draw3D_DrawText(TEXTE_PCB * text);
void InitGL();
void SetLights();
void Draw3D_Track( TRACK* track );
void Draw3D_Via( SEGVIA* via );
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
void Draw3D_DrawText( TEXTE_PCB* text );
//int Get3DLayerEnable(int act_layer);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class WinEDA3D_DrawFrame: public wxFrame
class WinEDA3D_DrawFrame : public wxFrame
{
public:
WinEDA_BasePcbFrame * m_Parent;
Pcb3D_GLCanvas * m_Canvas;
WinEDA_Toolbar * m_HToolBar;
WinEDA_Toolbar * m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
WinEDA_BasePcbFrame* m_Parent;
Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
#if KICAD_AUIMANAGER
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
private:
wxString m_FrameName; // name used for writting and reading setup
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent,
const wxString& title,
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent & Event);
void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateMenuBar();
void ReCreateHToolbar();
void ReCreateVToolbar();
@ -205,13 +207,13 @@ public:
void GetSettings();
void SaveSettings();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
void OnKeyEvent(wxKeyEvent& event);
int BestZoom(); // Retourne le meilleur zoom
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
void Process_Special_Functions(wxCommandEvent& event);
void Process_Zoom(wxCommandEvent& event);
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnKeyEvent( wxKeyEvent& event );
int BestZoom();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom( wxCommandEvent& event );
void NewDisplay();
void Set3DBgColor();
@ -227,13 +229,13 @@ public:
DECLARE_EVENT_TABLE()
};
void SetGLColor(int color);
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
void SetGLColor( int color );
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord );
extern Info_3D_Visu g_Parm_3D_Visu;
extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop;
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
extern int gl_attrib[];
extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop;
extern double DataScale3D; // 3D scale units.
extern int gl_attrib[];
#endif /* __3D_VIEWER_H__ */

View File

@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
// Add all pins sheets of a selected hierarchical sheet to the list
Hierarchical_PIN_Sheet_Struct* SLabel =
( (DrawSheetStruct*) Struct )->m_Label;
SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
while( SLabel )
{
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
AddPickedItem( screen, SLabel->m_Pos );
SLabel = (Hierarchical_PIN_Sheet_Struct*) SLabel->Next();
SLabel = (SCH_SHEET_PIN*) SLabel->Next();
}
}

View File

@ -300,7 +300,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
/* Fill aList with Glabel info
*/
SCH_ITEM* DrawList;
Hierarchical_PIN_Sheet_Struct* PinLabel;
SCH_SHEET_PIN* PinLabel;
DrawSheetPath* sheet;
/* Build the sheet list */
@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
case DRAW_SHEET_STRUCT_TYPE:
{
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
while( PinLabel != NULL )
{
labet_object.m_LabelType =
@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
wxString* Text1, * Text2;
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) (obj1.m_Label) )->m_Text;
Text1 = &( (SCH_SHEET_PIN*) (obj1.m_Label) )->m_Text;
else
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) (obj2.m_Label) )->m_Text;
Text2 = &( (SCH_SHEET_PIN*) (obj2.m_Label) )->m_Text;
else
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
@ -464,12 +464,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
if( ii == 0 )
{
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text1 = ( (Hierarchical_PIN_Sheet_Struct*) obj1.m_Label )->m_Text;
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
else
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
Text2 = ( (Hierarchical_PIN_Sheet_Struct*) obj2.m_Label )->m_Text;
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
else
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
@ -804,7 +804,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
{
/************************************************************************/
SCH_LABEL* DrawTextItem;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
SCH_SHEET_PIN* DrawSheetLabel;
wxString msg, sheetpath;
wxString labeltype;
@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
{
DrawSheetLabel =
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
int jj = DrawSheetLabel->m_Shape;
if( jj < 0 )
jj = NET_TMAX;

View File

@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
EDA_BaseStruct* item;
LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet;
SCH_SHEET_PIN* pinsheet;
wxPoint itempos;
switch( layer )

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
@ -24,7 +24,7 @@
/***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
{
/***********************************************************/
@ -41,10 +41,10 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
/**************************************/
DrawSheetStruct::~DrawSheetStruct()
SCH_SHEET::~SCH_SHEET()
{
/**************************************/
Hierarchical_PIN_Sheet_Struct* label = m_Label, * next_label;
SCH_SHEET_PIN* label = m_Label, * next_label;
while( label )
{
@ -65,7 +65,7 @@ DrawSheetStruct::~DrawSheetStruct()
/**********************************************/
bool DrawSheetStruct::Save( FILE* aFile ) const
bool SCH_SHEET::Save( FILE* aFile ) const
/***********************************************/
/** Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
@ -74,7 +74,7 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
*/
{
bool Success = true;
Hierarchical_PIN_Sheet_Struct* SheetLabel;
SCH_SHEET_PIN* SheetLabel;
fprintf( aFile, "$Sheet\n" );
@ -128,13 +128,13 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
/***********************************************/
DrawSheetStruct* DrawSheetStruct::GenCopy()
SCH_SHEET* SCH_SHEET::GenCopy()
{
/***********************************************/
/* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated
*/
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
newitem->m_Size = m_Size;
@ -153,7 +153,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
newitem->m_Label = NULL;
Hierarchical_PIN_Sheet_Struct* Slabel = NULL, * label = m_Label;
SCH_SHEET_PIN* Slabel = NULL, * label = m_Label;
if( label )
{
@ -180,7 +180,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
/**********************************************************/
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
{
/**********************************************************/
/* Used if undo / redo command:
@ -196,7 +196,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
// Ensure sheet labels have their .m_Parent member poiuntin really on their
// parent, after swapping.
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label )
{
label->SetParent( this );
@ -213,7 +213,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/********************************************************************/
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{
/********************************************************************/
/* Place list structures for new sheet. */
@ -241,7 +241,7 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/********************************************************************/
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
bool aRedraw )
{
/********************************************************************/
@ -250,7 +250,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
* @param aRedraw = true to redraw Sheet
* @param aFrame = the schematic frame
*/
Hierarchical_PIN_Sheet_Struct* Pinsheet, * NextPinsheet;
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
return;
@ -291,16 +291,15 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int DrawSheetStruct::GetPenSize()
int SCH_SHEET::GetPenSize()
{
return g_DrawDefaultLineThickness;
}
/*****************************************************************************/
void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode, int aColor )
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDrawMode, int aColor )
{
/*****************************************************************************/
/** Function Draw
@ -312,7 +311,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items
*/
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
SCH_SHEET_PIN* SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
@ -366,7 +365,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/*****************************************/
EDA_Rect DrawSheetStruct::GetBoundingBox()
EDA_Rect SCH_SHEET::GetBoundingBox()
{
/*****************************************/
/** Function GetBoundingBox
@ -391,7 +390,7 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
/************************************************/
bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
{
/************************************************/
/** Function HitTest
@ -405,7 +404,7 @@ bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
/************************************/
int DrawSheetStruct::ComponentCount()
int SCH_SHEET::ComponentCount()
{
/************************************/
/** Function ComponentCount
@ -427,7 +426,7 @@ int DrawSheetStruct::ComponentCount()
}
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) bs;
SCH_SHEET* sheet = (SCH_SHEET*) bs;
n += sheet->ComponentCount();
}
}
@ -437,8 +436,7 @@ int DrawSheetStruct::ComponentCount()
/*****************************************************************************/
bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
SCH_SCREEN** aScreen )
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
{
/*****************************************************************************/
/** Function SearchHierarchy
@ -454,7 +452,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->m_AssociatedScreen
&& ss->m_AssociatedScreen->m_FileName.CmpNoCase( aFilename ) == 0 )
{
@ -472,8 +470,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
/*******************************************************************************/
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
DrawSheetPath* aList )
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
{
/*******************************************************************************/
/** Function LocatePathOfScreen
@ -496,7 +493,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->LocatePathOfScreen( aScreen, aList ) )
return true;
}
@ -510,7 +507,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
/**********************************************************/
bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
{
/***********************************************************/
/** Function Load.
@ -546,7 +543,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
{
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheetstruct = (DrawSheetStruct*) bs;
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
if( !sheetstruct->Load( aFrame ) )
success = false;
}
@ -560,7 +557,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
/**********************************/
int DrawSheetStruct::CountSheets()
int SCH_SHEET::CountSheets()
{
/**********************************/
/** Function CountSheets
@ -577,7 +574,7 @@ int DrawSheetStruct::CountSheets()
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* subsheet = (DrawSheetStruct*) strct;
SCH_SHEET* subsheet = (SCH_SHEET*) strct;
count += subsheet->CountSheets();
}
}
@ -587,7 +584,7 @@ int DrawSheetStruct::CountSheets()
/******************************************/
wxString DrawSheetStruct::GetFileName( void )
wxString SCH_SHEET::GetFileName( void )
{
/******************************************/
return m_FileName;
@ -595,7 +592,7 @@ wxString DrawSheetStruct::GetFileName( void )
/************************************************************************/
bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName )
{
/************************************************************************/
@ -710,7 +707,7 @@ otherwise delete current sheet data)" );
/***********************************************************/
void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
{
frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
@ -722,7 +719,7 @@ void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
* mirror item relative to an Y axis
* @param aYaxis_position = the y axis position
*/
void DrawSheetStruct::Mirror_Y( int aYaxis_position )
void SCH_SHEET::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
@ -730,7 +727,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
m_Pos.x -= m_Size.x;
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
{
label->Mirror_Y( aYaxis_position );
@ -740,7 +737,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
#if defined(DEBUG)
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
{
// XML output:
wxString s = GetClass();
@ -750,7 +747,7 @@ void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
<< '"' << ">\n";
// show all the pins, and check the linked list integrity
Hierarchical_PIN_Sheet_Struct* label;
SCH_SHEET_PIN* label;
for( label = m_Label; label; label = label->Next() )
{
label->Show( nestLevel + 1, os );

View File

@ -7,17 +7,19 @@
#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
* a component
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire,
* bus or label
* A sheet level it corresponds to a hierarchical label.
/**
* Pin (label) used in sheets to create hierarchical schematics.
*
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* pin is used in a component. It connects the ojects in the sheet object
* to the objects in the schecmitic page to the objects in the page that is
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
* connected to a wire, bus, or label. In the schematic page represented by
* the sheet, it corresponds to a hierarchical label.
*/
class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
public EDA_TextStruct
class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
{
public:
int m_Edge, m_Shape;
@ -26,23 +28,23 @@ public:
// m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename
public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
public: SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { }
~SCH_SHEET_PIN() { }
virtual wxString GetClass() const
{
return wxT( "Hierarchical_PIN_Sheet_Struct" );
return wxT( "SCH_SHEET_PIN" );
}
Hierarchical_PIN_Sheet_Struct* GenCopy();
SCH_SHEET_PIN* GenCopy();
Hierarchical_PIN_Sheet_Struct* Next()
SCH_SHEET_PIN* Next()
{
return ( Hierarchical_PIN_Sheet_Struct*) Pnext;
return ( SCH_SHEET_PIN*) Pnext;
}
void Place( WinEDA_SchematicFrame* frame,
@ -108,12 +110,12 @@ public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
};
/* class DrawSheetStruct
/* class SCH_SHEET
* This class is the sheet symbol placed in a schematic, and is the entry point
* for a sub schematic
*/
class DrawSheetStruct : public SCH_ITEM
class SCH_SHEET : public SCH_ITEM
{
public:
wxString m_SheetName; /* this is equivalent to C101 for
@ -132,22 +134,23 @@ public:
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of *sheet symbol */
int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked
* list.*/
SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
* list.*/
int m_NbLabel; /* Pins sheet (corresponding to
* hierarchical labels) count */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
* handle the physical data
* In complex hierarchies we
* can have many DrawSheetStruct
* can have many SCH_SHEET
* using the same data
*/
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct();
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_SHEET();
virtual wxString GetClass() const
{
return wxT( "DrawSheetStruct" );
return wxT( "SCH_SHEET" );
}
@ -158,23 +161,23 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
bool Save( FILE* aFile ) const;
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function CleanupSheet
* Delete pinsheets which are not corresponding to a hierarchical label
* @param aRedraw = true to redraw Sheet
* @param aFrame = the schematic frame
*/
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize();
virtual int GetPenSize();
/** Function Draw
* Draw the hierarchical sheet shape
@ -185,11 +188,11 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
* @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items
*/
void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode,
int aColor = -1 );
void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode,
int aColor = -1 );
/** Function HitTest
* @return true if the point aPosRef is within item area
@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
*/
EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem );
void SwapData( SCH_SHEET* copyitem );
/** Function ComponentCount
* count our own components, without the power components.
@ -277,7 +280,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName );
//void RemoveSheet(DrawSheetStruct* sheet);
//void RemoveSheet(SCH_SHEET* sheet);
//to remove a sheet, just delete it
//-- the destructor should take care of everything else.
@ -290,7 +293,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
{
label->Move( aMoveVector );

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
{
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
Push( sheet );
if( aPath == Path() )
return true;
@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* DrawSheetPath::Last()
SCH_SHEET* DrawSheetPath::Last()
{
if( m_numSheets )
return m_sheets[m_numSheets - 1];
@ -134,12 +134,12 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
/**************************************************/
void DrawSheetPath::Push( DrawSheetStruct* aSheet )
void DrawSheetPath::Push( SCH_SHEET* aSheet )
{
/**************************************************/
/** Function Push
* store (push) aSheet in list
* @param aSheet = pointer to the DrawSheetStruct to store in list
* @param aSheet = pointer to the SCH_SHEET to store in list
*/
if( m_numSheets > DSLSZ )
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
@ -153,11 +153,11 @@ to store sheet" ) );
}
DrawSheetStruct* DrawSheetPath::Pop()
SCH_SHEET* DrawSheetPath::Pop()
{
/** Function Pop
* retrieves (pop) the last entered sheet and remove it from list
* @return a DrawSheetStruct* pointer to the removed sheet in list
* @return a SCH_SHEET* pointer to the removed sheet in list
*/
if( m_numSheets > 0 )
{
@ -287,7 +287,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
/*******************************************************/
EDA_SheetList::EDA_SheetList( DrawSheetStruct* aSheet )
EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet )
{
/*******************************************************/
/* The constructor: build the list of sheets from aSheet.
@ -347,7 +347,7 @@ DrawSheetPath* EDA_SheetList::GetSheet( int aIndex )
/************************************************************************/
void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet )
{
/************************************************************************/
/** Function BuildSheetList
@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet );
}
strct = strct->Next();

View File

@ -70,7 +70,7 @@ private:
public:
#define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct * m_sheets[DSLSZ];
SCH_SHEET * m_sheets[DSLSZ];
public: DrawSheetPath();
~DrawSheetPath() { };
@ -97,7 +97,7 @@ public: DrawSheetPath();
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* Last();
SCH_SHEET* Last();
/** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list
@ -112,19 +112,19 @@ public: DrawSheetPath();
/** Function Push
* store (push) aSheet in list
* @param aSheet = pointer to the DrawSheetStruct to store in list
* @param aSheet = pointer to the SCH_SHEET to store in list
* Push is used when entered a sheet to select or analyze it
* This is like cd <directory> in directories navigation
*/
void Push( DrawSheetStruct* aSheet );
void Push( SCH_SHEET* aSheet );
/** Function Pop
* retrieves (pop) the last entered sheet and remove it from list
* @return a DrawSheetStruct* pointer to the removed sheet in list
* @return a SCH_SHEET* pointer to the removed sheet in list
* Pop is used when leaving a sheet after a selection or analyze
* This is like cd .. in directories navigation
*/
DrawSheetStruct* Pop();
SCH_SHEET* Pop();
/** Function Path
* the path uses the time stamps which do not changes even when editing
@ -202,7 +202,7 @@ public:
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
* So usually call it with no param.
*/
EDA_SheetList( DrawSheetStruct* aSheet = NULL );
EDA_SheetList( SCH_SHEET* aSheet = NULL );
~EDA_SheetList()
{
@ -243,7 +243,7 @@ private:
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
* @param aSheet = the starting sheet from the built is made
*/
void BuildSheetList( DrawSheetStruct* sheet );
void BuildSheetList( SCH_SHEET* sheet );
};
#endif /* CLASS_DRAWSHEET_PATH_H */

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
// Name: class_hierarchical_PIN_sheet.cpp
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
// Purpose: member functions SCH_SHEET_PIN
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
@ -23,10 +23,9 @@
/*******************************************************************/
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
DrawSheetStruct* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
EDA_TextStruct( text )
{
@ -43,12 +42,11 @@ Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
/***********************************************************/
Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
{
/***********************************************************/
Hierarchical_PIN_Sheet_Struct* newitem =
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos,
m_Text );
SCH_SHEET_PIN* newitem =
new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
@ -61,18 +59,18 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int Hierarchical_PIN_Sheet_Struct::GetPenSize()
int SCH_SHEET_PIN::GetPenSize()
{
return g_DrawDefaultLineThickness;
}
/*****************************************************************************/
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color )
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color )
{
/*****************************************************************************/
/* Routine to create hierarchical labels */
@ -124,9 +122,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
* @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
{
wxSize size = m_Size;
@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
bool SCH_SHEET_PIN::Save( FILE* aFile ) const
{
int type = 'U', side = 'L';
@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
#if defined(DEBUG)
void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
{
// XML output:
wxString s = GetClass();

View File

@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT()
{
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
m_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
m_Link = NULL; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
m_Flag = 0; /* flag used in calculations */

View File

@ -41,8 +41,8 @@ class NETLIST_OBJECT
public:
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */
EDA_BaseStruct* m_Comp; /* Pointer on the library item that created this net object (the parent)*/
SCH_ITEM* m_Link; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
int m_Flag; /* flag used in calculations */

View File

@ -251,7 +251,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
{
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* ds = (DrawSheetStruct*) s;
SCH_SHEET* ds = (SCH_SHEET*) s;
s = ds->m_AssociatedScreen;
}
if( s && s->Type() == SCREEN_STRUCT_TYPE )

View File

@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct )
{
( (DrawSheetStruct*) DrawStruct )->DisplayInfo( this );
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
return DrawStruct;
}

View File

@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SHEET_STRUCT_TYPE:
{
Hierarchical_PIN_Sheet_Struct* pinsheet;
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label;
SCH_SHEET_PIN* pinsheet;
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
pinsheet;
pinsheet = pinsheet->Next() )
{

View File

@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
EDA_BaseStruct* DrawList;
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
SCH_SHEET_PIN* SheetLabel, * NextLabel;
if( DrawStruct == NULL )
return;
@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
continue;
/* See if our item is in this Sheet */
SheetLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
if( SheetLabel == NULL )
continue;
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
{
( (DrawSheetStruct*) DrawList )->m_Label =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
( (SCH_SHEET*) DrawList )->m_Label =
(SCH_SHEET_PIN*) SheetLabel->Next();
SAFE_DELETE( DrawStruct );
return;
@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
while( SheetLabel->Next() )
{
NextLabel =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
{
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
SAFE_DELETE( DrawStruct );

View File

@ -13,7 +13,7 @@
/**************************************************************************/
void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
/**************************************************************************/
/* Free (delete) all schematic data (include the sub hierarchy sheets )
@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct,
confirm_deletion );
}
}

View File

@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case DRAW_SHEET_STRUCT_TYPE:
{
DrawSheetStruct* Struct = (DrawSheetStruct*) aItem;
SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox,
aDC,
Struct->m_Pos.x + aOffset.x,

Some files were not shown because too many files have changed in this diff Show More