Commit 4c858cbb authored by Wayne Stambaugh's avatar Wayne Stambaugh

3D viewer coding style policy fixes.

parent 5427a68a
...@@ -26,16 +26,17 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord ) ...@@ -26,16 +26,17 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
coord[ii].x *= m_MatScale.x; coord[ii].x *= m_MatScale.x;
coord[ii].y *= m_MatScale.y; coord[ii].y *= m_MatScale.y;
coord[ii].z *= m_MatScale.z; coord[ii].z *= m_MatScale.z;
/* adjust rotation */ /* adjust rotation */
if( m_MatRotation.x ) if( m_MatRotation.x )
RotatePoint( &coord[ii].y, &coord[ii].z, RotatePoint( &coord[ii].y, &coord[ii].z, (int) (m_MatRotation.x * 10) );
(int) (m_MatRotation.x * 10) );
if( m_MatRotation.y ) if( m_MatRotation.y )
RotatePoint( &coord[ii].z, &coord[ii].x, RotatePoint( &coord[ii].z, &coord[ii].x, (int) (m_MatRotation.y * 10) );
(int) (m_MatRotation.y * 10) );
if( m_MatRotation.z ) if( m_MatRotation.z )
RotatePoint( &coord[ii].x, &coord[ii].y, RotatePoint( &coord[ii].x, &coord[ii].y, (int) (m_MatRotation.z * 10) );
(int) (m_MatRotation.z * 10) );
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */ /* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB) #define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV; coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
...@@ -68,6 +69,7 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord ) ...@@ -68,6 +69,7 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
nz = ax * by - ay * bx; nz = ax * by - ay * bx;
r = sqrt( nx * nx + ny * ny + nz * nz ); r = sqrt( nx * nx + ny * ny + nz * nz );
if( r >= 0.000001 ) /* avoid division by zero */ if( r >= 0.000001 ) /* avoid division by zero */
{ {
nx /= r; ny /= r; nz /= r; nx /= r; ny /= r; nz /= r;
...@@ -102,7 +104,7 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord ) ...@@ -102,7 +104,7 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
} }
GLuint Pcb3D_GLCanvas::DisplayCubeforTest() GLuint EDA_3D_CANVAS::DisplayCubeforTest()
{ {
GLuint gllist = glGenLists( 1 ); GLuint gllist = glGenLists( 1 );
...@@ -151,18 +153,19 @@ Info_3D_Visu::Info_3D_Visu() ...@@ -151,18 +153,19 @@ Info_3D_Visu::Info_3D_Visu()
m_Beginx = m_Beginy = 0.0; /* position of mouse */ m_Beginx = m_Beginy = 0.0; /* position of mouse */
m_Zoom = 1.0; /* field of view in degrees */ m_Zoom = 1.0; /* field of view in degrees */
trackball( m_Quat, 0.0, 0.0, 0.0, 0.0 ); trackball( m_Quat, 0.0, 0.0, 0.0, 0.0 );
for( ii = 0; ii < 4; ii++ ) for( ii = 0; ii < 4; ii++ )
m_Rot[ii] = 0.0; m_Rot[ii] = 0.0;
m_Layers = 1; m_Layers = 1;
m_BoardSettings = NULL; m_BoardSettings = NULL;
m_Draw3DAxis = TRUE; m_Draw3DAxis = true;
m_Draw3DModule = TRUE; m_Draw3DModule = true;
m_Draw3DZone = TRUE; m_Draw3DZone = true;
m_Draw3DComments = TRUE; m_Draw3DComments = true;
m_Draw3DDrawings = TRUE; m_Draw3DDrawings = true;
m_Draw3DEco1 = TRUE; m_Draw3DEco1 = true;
m_Draw3DEco2 = TRUE; m_Draw3DEco2 = true;
} }
...@@ -187,15 +190,12 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, ...@@ -187,15 +190,12 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
text = _( "Vertex " ); text = _( "Vertex " );
else else
text = title; text = title;
text += ReturnUnitSymbol( units ); text += ReturnUnitSymbol( units );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize( -1, -1 ), 0 );
wxSize( -1, -1 ), 0 );
BoxSizer->Add( BoxSizer->Add( msgtitle, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM | wxADJUST_MINSIZE );
msgtitle,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 ); wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
......
...@@ -50,27 +50,27 @@ void CheckGLError() ...@@ -50,27 +50,27 @@ void CheckGLError()
/* /*
* Pcb3D_GLCanvas implementation * EDA_3D_CANVAS implementation
*/ */
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas ) BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint ) EVT_PAINT( EDA_3D_CANVAS::OnPaint )
// key event: // key event:
EVT_CHAR( Pcb3D_GLCanvas::OnChar ) EVT_CHAR( EDA_3D_CANVAS::OnChar )
// mouse events // mouse events
EVT_RIGHT_DOWN( Pcb3D_GLCanvas::OnRightClick ) EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick )
EVT_MOUSEWHEEL( Pcb3D_GLCanvas::OnMouseWheel ) EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
EVT_MOTION( Pcb3D_GLCanvas::OnMouseMove ) EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
// other events // other events
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground ) EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, Pcb3D_GLCanvas::OnPopUpMenu ) EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
END_EVENT_TABLE() END_EVENT_TABLE()
Pcb3D_GLCanvas::Pcb3D_GLCanvas( EDA_3D_FRAME* parent, int* attribList ) : EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
#if wxCHECK_VERSION( 2, 7, 0 ) #if wxCHECK_VERSION( 2, 7, 0 )
wxGLCanvas( parent, -1, attribList, wxDefaultPosition, wxDefaultSize, wxGLCanvas( parent, -1, attribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE ) wxFULL_REPAINT_ON_RESIZE )
...@@ -94,7 +94,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( EDA_3D_FRAME* parent, int* attribList ) : ...@@ -94,7 +94,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( EDA_3D_FRAME* parent, int* attribList ) :
} }
Pcb3D_GLCanvas::~Pcb3D_GLCanvas() EDA_3D_CANVAS::~EDA_3D_CANVAS()
{ {
ClearLists(); ClearLists();
m_init = false; m_init = false;
...@@ -105,7 +105,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas() ...@@ -105,7 +105,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
} }
void Pcb3D_GLCanvas::ClearLists() void EDA_3D_CANVAS::ClearLists()
{ {
if( m_gllist > 0 ) if( m_gllist > 0 )
glDeleteLists( m_gllist, 1 ); glDeleteLists( m_gllist, 1 );
...@@ -114,14 +114,14 @@ void Pcb3D_GLCanvas::ClearLists() ...@@ -114,14 +114,14 @@ void Pcb3D_GLCanvas::ClearLists()
} }
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event ) void EDA_3D_CANVAS::OnChar( wxKeyEvent& event )
{ {
SetView3D( event.GetKeyCode() ); SetView3D( event.GetKeyCode() );
event.Skip(); event.Skip();
} }
void Pcb3D_GLCanvas::SetView3D( int keycode ) void EDA_3D_CANVAS::SetView3D( int keycode )
{ {
int ii; int ii;
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom; double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
...@@ -237,7 +237,7 @@ void Pcb3D_GLCanvas::SetView3D( int keycode ) ...@@ -237,7 +237,7 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
} }
void Pcb3D_GLCanvas::OnMouseWheel( wxMouseEvent& event ) void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
{ {
wxSize size( GetClientSize() ); wxSize size( GetClientSize() );
...@@ -288,7 +288,7 @@ void Pcb3D_GLCanvas::OnMouseWheel( wxMouseEvent& event ) ...@@ -288,7 +288,7 @@ void Pcb3D_GLCanvas::OnMouseWheel( wxMouseEvent& event )
} }
void Pcb3D_GLCanvas::OnMouseMove( wxMouseEvent& event ) void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
{ {
wxSize size( GetClientSize() ); wxSize size( GetClientSize() );
double spin_quat[4]; double spin_quat[4];
...@@ -331,7 +331,7 @@ void Pcb3D_GLCanvas::OnMouseMove( wxMouseEvent& event ) ...@@ -331,7 +331,7 @@ void Pcb3D_GLCanvas::OnMouseMove( wxMouseEvent& event )
/* Construct and display a popup menu when the right button is clicked. /* Construct and display a popup menu when the right button is clicked.
*/ */
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event ) void EDA_3D_CANVAS::OnRightClick( wxMouseEvent& event )
{ {
wxPoint pos; wxPoint pos;
wxMenu PopUpMenu; wxMenu PopUpMenu;
...@@ -406,7 +406,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event ) ...@@ -406,7 +406,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
} }
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event ) void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent& event )
{ {
int key = 0; int key = 0;
...@@ -468,7 +468,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event ) ...@@ -468,7 +468,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
} }
void Pcb3D_GLCanvas::DisplayStatus() void EDA_3D_CANVAS::DisplayStatus()
{ {
wxString msg; wxString msg;
...@@ -483,7 +483,7 @@ void Pcb3D_GLCanvas::DisplayStatus() ...@@ -483,7 +483,7 @@ void Pcb3D_GLCanvas::DisplayStatus()
} }
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event ) void EDA_3D_CANVAS::OnPaint( wxPaintEvent& event )
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
...@@ -492,14 +492,14 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event ) ...@@ -492,14 +492,14 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
} }
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event ) void EDA_3D_CANVAS::OnEraseBackground( wxEraseEvent& event )
{ {
// Do nothing, to avoid flashing. // Do nothing, to avoid flashing.
} }
/* Initialize broad parameters for OpenGL */ /* Initialize broad parameters for OpenGL */
void Pcb3D_GLCanvas::InitGL() void EDA_3D_CANVAS::InitGL()
{ {
wxSize size = GetClientSize(); wxSize size = GetClientSize();
...@@ -568,7 +568,7 @@ void Pcb3D_GLCanvas::InitGL() ...@@ -568,7 +568,7 @@ void Pcb3D_GLCanvas::InitGL()
g_Parm_3D_Visu.m_BgColor.m_Blue, 1 ); g_Parm_3D_Visu.m_BgColor.m_Blue, 1 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// Setup light souces: // Setup light sources:
SetLights(); SetLights();
CheckGLError(); CheckGLError();
...@@ -576,7 +576,7 @@ void Pcb3D_GLCanvas::InitGL() ...@@ -576,7 +576,7 @@ void Pcb3D_GLCanvas::InitGL()
/* Initialize OpenGL light sources. */ /* Initialize OpenGL light sources. */
void Pcb3D_GLCanvas::SetLights() void EDA_3D_CANVAS::SetLights()
{ {
double light; double light;
GLfloat light_color[4]; GLfloat light_color[4];
...@@ -604,7 +604,7 @@ void Pcb3D_GLCanvas::SetLights() ...@@ -604,7 +604,7 @@ void Pcb3D_GLCanvas::SetLights()
/* Create a Screenshot of the current 3D view. /* Create a Screenshot of the current 3D view.
* Output file format is png or jpeg, or image is copied to the clipboard * Output file format is png or jpeg, or image is copied to the clipboard
*/ */
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event ) void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
{ {
wxFileName fn( m_Parent->m_Parent->GetScreen()->GetFileName() ); wxFileName fn( m_Parent->m_Parent->GetScreen()->GetFileName() );
wxString FullFileName; wxString FullFileName;
......
...@@ -52,7 +52,7 @@ static void CALLBACK tessErrorCB( GLenum errorCode ); ...@@ -52,7 +52,7 @@ static void CALLBACK tessErrorCB( GLenum errorCode );
static void CALLBACK tessCPolyPt2Vertex( const GLvoid* data ); static void CALLBACK tessCPolyPt2Vertex( const GLvoid* data );
static void CALLBACK tesswxPoint2Vertex( const GLvoid* data ); static void CALLBACK tesswxPoint2Vertex( const GLvoid* data );
void Pcb3D_GLCanvas::Redraw( bool finish ) void EDA_3D_CANVAS::Redraw( bool finish )
{ {
/* SwapBuffer requires the window to be shown before calling */ /* SwapBuffer requires the window to be shown before calling */
if( !IsShown() ) if( !IsShown() )
...@@ -110,7 +110,7 @@ void Pcb3D_GLCanvas::Redraw( bool finish ) ...@@ -110,7 +110,7 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
/* Create the draw list items /* Create the draw list items
*/ */
GLuint Pcb3D_GLCanvas::CreateDrawGL_List() GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{ {
PCB_BASE_FRAME* pcbframe = m_Parent->m_Parent; PCB_BASE_FRAME* pcbframe = m_Parent->m_Parent;
BOARD* pcb = pcbframe->GetBoard(); BOARD* pcb = pcbframe->GetBoard();
...@@ -219,8 +219,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -219,8 +219,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
glEnd(); glEnd();
#endif #endif
/* move the board in order to draw it with its center at 0,0 3D /* move the board in order to draw it with its center at 0,0 3D coordinates */
* coordinates */
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale, 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, -g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
0.0F ); 0.0F );
...@@ -248,6 +247,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -248,6 +247,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
for( ii = 0; ii < pcb->GetAreaCount(); ii++ ) for( ii = 0; ii < pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* curr_zone = pcb->GetArea( ii ); ZONE_CONTAINER* curr_zone = pcb->GetArea( ii );
if( curr_zone->m_FillMode == 0 ) if( curr_zone->m_FillMode == 0 )
{ {
// solid polygons only are used to fill areas // solid polygons only are used to fill areas
...@@ -295,6 +295,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -295,6 +295,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
for( int ic = 1; ic <= imax; ic++ ) for( int ic = 1; ic <= imax; ic++ )
{ {
CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
if( begincorner->utility == 0 ) if( begincorner->utility == 0 )
{ {
// Draw only basic outlines, not extra segments // Draw only basic outlines, not extra segments
...@@ -304,6 +305,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -304,6 +305,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
dummysegment.m_End.y = endcorner->y; dummysegment.m_End.y = endcorner->y;
Draw3D_Track( &dummysegment ); Draw3D_Track( &dummysegment );
} }
if( (endcorner->end_contour) || (ic == imax) ) if( (endcorner->end_contour) || (ic == imax) )
{ {
// the last corner of a filled area is found: draw it // the last corner of a filled area is found: draw it
...@@ -368,7 +370,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -368,7 +370,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
} }
void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track ) void EDA_3D_CANVAS::Draw3D_Track( TRACK* track )
{ {
double zpos; double zpos;
int layer = track->GetLayer(); int layer = track->GetLayer();
...@@ -402,7 +404,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track ) ...@@ -402,7 +404,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
* draw all solid polygons used as filles areas in a zone * draw all solid polygons used as filles areas in a zone
* @param aZone = the zone to draw * @param aZone = the zone to draw
*/ */
void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
{ {
double zpos; double zpos;
int layer = aZone->GetLayer(); int layer = aZone->GetLayer();
...@@ -435,6 +437,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -435,6 +437,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
// Draw solid areas contained in this zone // Draw solid areas contained in this zone
int StartContour = 1; int StartContour = 1;
for( unsigned ii = 0; ii < aZone->m_FilledPolysList.size(); ii++ ) for( unsigned ii = 0; ii < aZone->m_FilledPolysList.size(); ii++ )
{ {
if( StartContour == 1 ) if( StartContour == 1 )
...@@ -443,6 +446,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -443,6 +446,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
gluTessBeginContour( tess ); gluTessBeginContour( tess );
StartContour = 0; StartContour = 0;
} }
v_data[0] = aZone->m_FilledPolysList[ii].x * g_Parm_3D_Visu.m_BoardScale; v_data[0] = aZone->m_FilledPolysList[ii].x * g_Parm_3D_Visu.m_BoardScale;
v_data[1] = -aZone->m_FilledPolysList[ii].y * g_Parm_3D_Visu.m_BoardScale; v_data[1] = -aZone->m_FilledPolysList[ii].y * g_Parm_3D_Visu.m_BoardScale;
gluTessVertex( tess, v_data, &aZone->m_FilledPolysList[ii] ); gluTessVertex( tess, v_data, &aZone->m_FilledPolysList[ii] );
...@@ -461,7 +465,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) ...@@ -461,7 +465,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
/* 3D drawing for a VIA (cylinder + filled circles) /* 3D drawing for a VIA (cylinder + filled circles)
*/ */
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
{ {
double x, y, r, hole; double x, y, r, hole;
int layer, top_layer, bottom_layer; int layer, top_layer, bottom_layer;
...@@ -480,6 +484,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -480,6 +484,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_Layers; layer++ ) for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_Layers; layer++ )
{ {
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( layer < g_Parm_3D_Visu.m_Layers - 1 ) 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 )
...@@ -519,7 +524,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via ) ...@@ -519,7 +524,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
} }
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
{ {
double x, y, xf, yf; double x, y, xf, yf;
double zpos, w; double zpos, w;
...@@ -608,7 +613,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf ) ...@@ -608,7 +613,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
} }
void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text ) void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
{ {
int layer = text->GetLayer(); int layer = text->GetLayer();
...@@ -661,7 +666,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -661,7 +666,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
} }
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
D_PAD* pad = m_Pads; D_PAD* pad = m_Pads;
...@@ -676,7 +681,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -676,7 +681,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/* Draw module shape: 3D shape if exists (or module outlines if not exists) */ /* Draw module shape: 3D shape if exists (or module outlines if not exists) */
S3D_MASTER* Struct3D = m_3D_Drawings; S3D_MASTER* Struct3D = m_3D_Drawings;
bool As3dShape = FALSE; bool As3dShape = false;
if( g_Parm_3D_Visu.m_Draw3DModule ) if( g_Parm_3D_Visu.m_Draw3DModule )
{ {
...@@ -703,7 +708,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -703,7 +708,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
{ {
if( !Struct3D->m_Shape3DName.IsEmpty() ) if( !Struct3D->m_Shape3DName.IsEmpty() )
{ {
As3dShape = TRUE; As3dShape = true;
Struct3D->ReadData(); Struct3D->ReadData();
} }
} }
...@@ -739,7 +744,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -739,7 +744,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
} }
void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
wxString s; wxString s;
int dx, dy; int dx, dy;
...@@ -862,7 +867,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -862,7 +867,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/* Draw 3D pads. */ /* Draw 3D pads. */
void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
int ii, ll, layer, nlmax; int ii, ll, layer, nlmax;
int ux0, uy0, int ux0, uy0,
...@@ -907,8 +912,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -907,8 +912,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
nlmax = g_Parm_3D_Visu.m_Layers - 1; nlmax = g_Parm_3D_Visu.m_Layers - 1;
Oncu = (m_layerMask & LAYER_BACK) ? TRUE : FALSE; Oncu = (m_layerMask & LAYER_BACK) ? true : false;
Oncmp = (m_layerMask & LAYER_FRONT) ? TRUE : FALSE; Oncmp = (m_layerMask & LAYER_FRONT) ? true : false;
Both = Oncu && Oncmp; Both = Oncu && Oncmp;
switch( m_PadShape & 0x7F ) switch( m_PadShape & 0x7F )
...@@ -1364,10 +1369,10 @@ static void Draw3D_CircleSegment( double startx, double starty, double endx, ...@@ -1364,10 +1369,10 @@ static void Draw3D_CircleSegment( double startx, double starty, double endx,
/** /**
* Function Draw3D_Polygon * Function Draw3D_Polygon
* draw one solid polygon * draw one solid polygon
* @param aCornersList = a std::vector<wxPoint> liste of corners, in physical coordinates * @param aCornersList = a std::vector<wxPoint> list of corners, in physical coordinates
* @param aZpos = the z position in 3D units * @param aZpos = the z position in 3D units
*/ */
void Pcb3D_GLCanvas::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double aZpos ) void EDA_3D_CANVAS::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double aZpos )
{ {
g_Parm_3D_Visu.m_ActZpos = aZpos; g_Parm_3D_Visu.m_ActZpos = aZpos;
...@@ -1407,19 +1412,19 @@ static int Get3DLayerEnable( int act_layer ) ...@@ -1407,19 +1412,19 @@ static int Get3DLayerEnable( int act_layer )
{ {
bool enablelayer; bool enablelayer;
enablelayer = TRUE; enablelayer = true;
if( act_layer == DRAW_N && !g_Parm_3D_Visu.m_Draw3DDrawings ) if( act_layer == DRAW_N && !g_Parm_3D_Visu.m_Draw3DDrawings )
enablelayer = FALSE; enablelayer = false;
if( act_layer == COMMENT_N && !g_Parm_3D_Visu.m_Draw3DComments ) if( act_layer == COMMENT_N && !g_Parm_3D_Visu.m_Draw3DComments )
enablelayer = FALSE; enablelayer = false;
if( act_layer == ECO1_N && !g_Parm_3D_Visu.m_Draw3DEco1 ) if( act_layer == ECO1_N && !g_Parm_3D_Visu.m_Draw3DEco1 )
enablelayer = FALSE; enablelayer = false;
if( act_layer == ECO2_N && !g_Parm_3D_Visu.m_Draw3DEco2 ) if( act_layer == ECO2_N && !g_Parm_3D_Visu.m_Draw3DEco2 )
enablelayer = FALSE; enablelayer = false;
return enablelayer; return enablelayer;
} }
......
...@@ -66,9 +66,9 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long ...@@ -66,9 +66,9 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long
// ReCreateAuxiliaryToolbar(); // ReCreateAuxiliaryToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
// Make a Pcb3D_GLCanvas // Make a EDA_3D_CANVAS
int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 }; int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 };
m_Canvas = new Pcb3D_GLCanvas( this, attrs ); m_Canvas = new EDA_3D_CANVAS( this, attrs );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
......
...@@ -24,9 +24,10 @@ int S3D_MASTER::ReadData() ...@@ -24,9 +24,10 @@ int S3D_MASTER::ReadData()
return 1; return 1;
} }
if( wxFileName::FileExists( m_Shape3DName ) ) if( wxFileName::FileExists( m_Shape3DName ) )
{
FullFilename = m_Shape3DName; FullFilename = m_Shape3DName;
}
else else
{ {
fn = m_Shape3DName; fn = m_Shape3DName;
...@@ -50,18 +51,23 @@ int S3D_MASTER::ReadData() ...@@ -50,18 +51,23 @@ int S3D_MASTER::ReadData()
// Switch the locale to standard C (needed to print floating point // Switch the locale to standard C (needed to print floating point
// numbers like 1.3) // numbers like 1.3)
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( stricmp( text, "DEF" ) == 0 ) if( stricmp( text, "DEF" ) == 0 )
{ {
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( text == NULL ) if( text == NULL )
continue; continue;
if( *text == '}' ) if( *text == '}' )
break; break;
if( stricmp( text, "children" ) == 0 ) if( stricmp( text, "children" ) == 0 )
{ {
ReadChildren( file, &LineNum ); ReadChildren( file, &LineNum );
...@@ -98,6 +104,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -98,6 +104,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
command = strtok( NULL, " \t\n\r" ); command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, " \t\n\r" );
mat_name = FROM_UTF8( text ); mat_name = FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 ) if( stricmp( command, "USE" ) == 0 )
{ {
for( material = m_Materials; material; material = material->Next() ) for( material = m_Materials; material; material = material->Next() )
...@@ -122,13 +129,16 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -122,13 +129,16 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( text == NULL ) if( text == NULL )
continue; continue;
if( text[0] == '}' ) if( text[0] == '}' )
{ {
material->SetMaterial(); material->SetMaterial();
return 0; return 0;
} }
if( stricmp( text, "diffuseColor" ) == 0 ) if( stricmp( text, "diffuseColor" ) == 0 )
{ {
text = strtok( NULL, " \t\n\r" ); text = strtok( NULL, " \t\n\r" );
...@@ -173,6 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -173,6 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
} }
} }
} }
return -1; return -1;
} }
...@@ -184,8 +195,10 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) ...@@ -184,8 +195,10 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( *text == ']' ) if( *text == ']' )
return 0; return 0;
if( *text == ',' ) if( *text == ',' )
continue; continue;
...@@ -212,6 +225,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) ...@@ -212,6 +225,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( *text == '}' ) if( *text == '}' )
{ {
err = 0; err = 0;
...@@ -245,6 +259,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) ...@@ -245,6 +259,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
if( *text == '}' ) if( *text == '}' )
{ {
err = 0; break; err = 0; break;
...@@ -283,18 +298,18 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) ...@@ -283,18 +298,18 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
* text_buffer contains the first line of this node : * text_buffer contains the first line of this node :
* "coord Coordinate { point [" * "coord Coordinate { point ["
*/ */
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
int* LineNum )
{ {
double* data_list = NULL; double* data_list = NULL;
unsigned int ii = 0, jj = 0, nn = BUFSIZE; unsigned int ii = 0, jj = 0, nn = BUFSIZE;
char* text; char* text;
bool HasData = FALSE; bool HasData = false;
bool StartData = FALSE; bool StartData = false;
bool EndNode = FALSE; bool EndNode = false;
char string_num[512]; char string_num[512];
text = text_buffer; text = text_buffer;
while( !EndNode ) while( !EndNode )
{ {
if( *text == 0 ) // Needs data ! if( *text == 0 ) // Needs data !
...@@ -308,13 +323,13 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, ...@@ -308,13 +323,13 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
switch( *text ) switch( *text )
{ {
case '[': case '[':
StartData = TRUE; StartData = true;
jj = 0; string_num[jj] = 0; jj = 0; string_num[jj] = 0;
data_list = (double*) MyZMalloc( nn * sizeof(double) ); data_list = (double*) MyZMalloc( nn * sizeof(double) );
break; break;
case '}': case '}':
EndNode = TRUE; EndNode = true;
break; break;
case ']': case ']':
...@@ -322,32 +337,38 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, ...@@ -322,32 +337,38 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
case ' ': case ' ':
case ',': case ',':
jj = 0; jj = 0;
if( !StartData || !HasData ) if( !StartData || !HasData )
break; break;
data_list[ii] = atof( string_num ); data_list[ii] = atof( string_num );
string_num[jj] = 0; string_num[jj] = 0;
ii++; ii++;
if( ii >= nn ) if( ii >= nn )
{ {
nn *= 2; nn *= 2;
data_list = data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) );
(double*) realloc( data_list, ( nn * sizeof(double) ) );
} }
HasData = FALSE;
HasData = false;
if( *text == ']' ) if( *text == ']' )
{ {
StartData = FALSE; StartData = false;
} }
break; break;
default: default:
if( !StartData ) if( !StartData )
break; break;
if( jj >= sizeof(string_num) ) if( jj >= sizeof(string_num) )
break; break;
string_num[jj] = *text; string_num[jj] = *text;
jj++; string_num[jj] = 0; jj++; string_num[jj] = 0;
HasData = TRUE; HasData = true;
break; break;
} }
...@@ -357,8 +378,10 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, ...@@ -357,8 +378,10 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
if( data_list ) if( data_list )
data_list = (double*) realloc( data_list, ( ii * sizeof(double) ) ); data_list = (double*) realloc( data_list, ( ii * sizeof(double) ) );
if( bufsize ) if( bufsize )
*bufsize = ii; *bufsize = ii;
return data_list; return data_list;
} }
...@@ -375,6 +398,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -375,6 +398,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
{ {
strcpy( buffer, line ); strcpy( buffer, line );
text = strtok( buffer, " \t\n\r" ); text = strtok( buffer, " \t\n\r" );
if( *text == '}' ) if( *text == '}' )
{ {
err = 0; break; err = 0; break;
...@@ -383,7 +407,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -383,7 +407,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normalPerVertex" ) == 0 ) if( stricmp( text, "normalPerVertex" ) == 0 )
{ {
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "TRUE" ) == 0 )
if( stricmp( text, "true" ) == 0 )
{ {
} }
else else
...@@ -395,7 +420,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -395,7 +420,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "colorPerVertex" ) == 0 ) if( stricmp( text, "colorPerVertex" ) == 0 )
{ {
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "TRUE" ) == 0 )
if( stricmp( text, "true" ) == 0 )
{ {
} }
else else
...@@ -407,8 +433,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -407,8 +433,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normal" ) == 0 ) if( stricmp( text, "normal" ) == 0 )
{ {
int coord_number; int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
LineNum );
// Do something if needed // Do something if needed
free( buf_points ); free( buf_points );
continue; continue;
...@@ -418,10 +444,12 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -418,10 +444,12 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " ,\t\n\r" ); text = strtok( line, " ,\t\n\r" );
while( text ) while( text )
{ {
if( *text == ']' ) if( *text == ']' )
break; break;
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
} }
...@@ -435,21 +463,24 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -435,21 +463,24 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "color" ) == 0 ) if( stricmp( text, "color" ) == 0 )
{ {
int coord_number; int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
LineNum );
// Do something if needed // Do something if needed
free( buf_points ); free( buf_points );
continue; continue;
} }
if( stricmp( text, "colorIndex" ) == 0 ) if( stricmp( text, "colorIndex" ) == 0 )
{ {
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " ,\t\n\r" ); text = strtok( line, " ,\t\n\r" );
while( text ) while( text )
{ {
if( *text == ']' ) if( *text == ']' )
break; break;
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
} }
...@@ -468,20 +499,24 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -468,20 +499,24 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
else if( stricmp( text, "coordIndex" ) == 0 ) else if( stricmp( text, "coordIndex" ) == 0 )
{ {
index = (int*) MyMalloc( nn * sizeof(int) ); index = (int*) MyMalloc( nn * sizeof(int) );
S3D_Vertex* coords = S3D_Vertex* coords = (S3D_Vertex*) MyMalloc( nn * sizeof(S3D_Vertex) );
(S3D_Vertex*) MyMalloc( nn * sizeof(S3D_Vertex) );
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
int coord_count = 0, jj; int coord_count = 0, jj;
text = strtok( line, " ,\t\n\r" ); text = strtok( line, " ,\t\n\r" );
while( text ) while( text )
{ {
if( *text == ']' ) if( *text == ']' )
break; break;
jj = atoi( text ); jj = atoi( text );
if( jj < 0 ) if( jj < 0 )
{ {
S3D_Vertex* curr_coord = coords; S3D_Vertex* curr_coord = coords;
for( jj = 0; jj < coord_count; jj++ ) for( jj = 0; jj < coord_count; jj++ )
{ {
int kk = index[jj] * 3; int kk = index[jj] * 3;
...@@ -499,6 +534,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -499,6 +534,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
{ {
index[coord_count++] = jj; index[coord_count++] = jj;
} }
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
} }
...@@ -523,7 +559,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) ...@@ -523,7 +559,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
} }
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum ) int Struct3D_Shape::ReadData( FILE* file, int* LineNum )
{ {
char line[512]; char line[512];
......
...@@ -16,13 +16,13 @@ void EDA_3D_FRAME::ReCreateHToolbar() ...@@ -16,13 +16,13 @@ void EDA_3D_FRAME::ReCreateHToolbar()
return; return;
} }
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
KiBitmap( import3d_xpm ), KiBitmap( import3d_xpm ),
_( "Reload board" ) ); _( "Reload board" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__ ) ) #if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux // Does not work properly under linux
...@@ -117,16 +117,13 @@ void EDA_3D_FRAME::ReCreateMenuBar() ...@@ -117,16 +117,13 @@ void EDA_3D_FRAME::ReCreateMenuBar()
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
_( "Create Image (png format)" ) ); fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__ ) ) #if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux // Does not work properly under linux
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, _( "Copy 3D Image to Clipboard" ) );
_( "Copy 3D Image to Clipboard" ) );
#endif #endif
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) ); fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
......
///////////////////////////////////////////////////////////////////////////// /**
// Name: 3d_viewer.h * @file 3d_viewer.h
///////////////////////////////////////////////////////////////////////////// */
#ifndef __3D_VIEWER_H__ #ifndef __3D_VIEWER_H__
#define __3D_VIEWER_H__ #define __3D_VIEWER_H__
...@@ -86,7 +85,7 @@ enum id_3dview_frm ...@@ -86,7 +85,7 @@ enum id_3dview_frm
}; };
class Pcb3D_GLCanvas; class EDA_3D_CANVAS;
class EDA_3D_FRAME; class EDA_3D_FRAME;
class Info_3D_Visu; class Info_3D_Visu;
class S3D_Vertex; class S3D_Vertex;
...@@ -129,7 +128,7 @@ public: Info_3D_Visu(); ...@@ -129,7 +128,7 @@ public: Info_3D_Visu();
}; };
class Pcb3D_GLCanvas : public wxGLCanvas class EDA_3D_CANVAS : public wxGLCanvas
{ {
public: public:
EDA_3D_FRAME* m_Parent; EDA_3D_FRAME* m_Parent;
...@@ -146,8 +145,8 @@ private: ...@@ -146,8 +145,8 @@ private:
#endif #endif
public: public:
Pcb3D_GLCanvas( EDA_3D_FRAME* parent, int* attribList = 0 ); EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList = 0 );
~Pcb3D_GLCanvas(); ~EDA_3D_CANVAS();
void ClearLists(); void ClearLists();
...@@ -209,7 +208,7 @@ public: ...@@ -209,7 +208,7 @@ public:
PCB_BASE_FRAME* m_Parent; PCB_BASE_FRAME* m_Parent;
private: private:
wxString m_FrameName; // name used for writing and reading setup. It is "Frame3D" wxString m_FrameName; // name used for writing and reading setup. It is "Frame3D"
Pcb3D_GLCanvas* m_Canvas; EDA_3D_CANVAS* m_Canvas;
EDA_TOOLBAR* m_HToolBar; EDA_TOOLBAR* m_HToolBar;
EDA_TOOLBAR* m_VToolBar; EDA_TOOLBAR* m_VToolBar;
int m_InternalUnits; int m_InternalUnits;
...@@ -238,7 +237,7 @@ public: ...@@ -238,7 +237,7 @@ public:
/** /**
* Function ReloadRequest * Function ReloadRequest
* must be called when reloading data from Pcbnew is needed * must be called when reloading data from Pcbnew is needed
* mainly after edition of the board or footprint beeing displayed. * mainly after edition of the board or footprint being displayed.
* mainly for the module editor. * mainly for the module editor.
*/ */
void ReloadRequest( ) void ReloadRequest( )
......
/*******************************************************/ /**
/* class_edge_module.h : EDGE_MODULE class definition. */ * @file class_edge_module.h
/*******************************************************/ * @brief EDGE_MODULE class definition.
*/
#ifndef _CLASS_EDGE_MOD_H_ #ifndef _CLASS_EDGE_MOD_H_
#define _CLASS_EDGE_MOD_H_ #define _CLASS_EDGE_MOD_H_
...@@ -8,13 +9,13 @@ ...@@ -8,13 +9,13 @@
#include "class_drawsegment.h" #include "class_drawsegment.h"
#include "richio.h" #include "richio.h"
class Pcb3D_GLCanvas; class EDA_3D_CANVAS;
class EDGE_MODULE : public DRAWSEGMENT class EDGE_MODULE : public DRAWSEGMENT
{ {
public: public:
wxPoint m_Start0; // Start point or centre, relative to module origin, orient 0. wxPoint m_Start0; // Start point or center, relative to module origin, orient 0.
wxPoint m_End0; // End point, relative to module origin, orient 0. wxPoint m_End0; // End point, relative to module origin, orient 0.
public: public:
...@@ -25,7 +26,7 @@ public: ...@@ -25,7 +26,7 @@ public:
EDGE_MODULE* Next() const { return (EDGE_MODULE*) Pnext; } EDGE_MODULE* Next() const { return (EDGE_MODULE*) Pnext; }
EDGE_MODULE* Back() const { return (EDGE_MODULE*) Pback; } EDGE_MODULE* Back() const { return (EDGE_MODULE*) Pback; }
void Copy( EDGE_MODULE* source ); // copy structure void Copy( EDGE_MODULE* source ); // copy structure
/** /**
* Function Save * Function Save
...@@ -33,17 +34,17 @@ public: ...@@ -33,17 +34,17 @@ public:
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int ReadDescr( LINE_READER* aReader ); int ReadDescr( LINE_READER* aReader );
void SetDrawCoord(); void SetDrawCoord();
/* drawing functions */ /* drawing functions */
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ); int aDrawMode, const wxPoint& offset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( EDA_3D_CANVAS* glcanvas );
/** /**
* Function DisplayInfo * Function DisplayInfo
...@@ -52,7 +53,7 @@ public: ...@@ -52,7 +53,7 @@ public:
* Is virtual from EDA_ITEM. * Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information. * @param frame A EDA_DRAW_FRAME in which to print status information.
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /**
...@@ -77,7 +78,7 @@ public: ...@@ -77,7 +78,7 @@ public:
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
virtual void Show( int nestLevel, std::ostream& os ); virtual void Show( int nestLevel, std::ostream& os );
......
...@@ -8,16 +8,11 @@ ...@@ -8,16 +8,11 @@
#define _MODULE_H_ #define _MODULE_H_
class Pcb3D_GLCanvas;
class S3D_MASTER;
#include "richio.h" #include "richio.h"
/************************************/ class EDA_3D_CANVAS;
/* Modules (footprints) description */ class S3D_MASTER;
/* pad are in class_pad.xx */
/************************************/
enum Mod_Attribut /* Attributes used for modules */ enum Mod_Attribut /* Attributes used for modules */
...@@ -41,13 +36,12 @@ public: ...@@ -41,13 +36,12 @@ public:
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
DLIST<D_PAD> m_Pads; /* Pad list (linked list) */ DLIST<D_PAD> m_Pads; /* Pad list (linked list) */
DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */ DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */
DLIST<S3D_MASTER> m_3D_Drawings; /* First item of the 3D shapes (linked DLIST<S3D_MASTER> m_3D_Drawings; /* First item of the 3D shapes (linked list)*/
* list)*/
TEXTE_MODULE* m_Reference; // Component reference (U34, R18..) TEXTE_MODULE* m_Reference; // Component reference (U34, R18..)
TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..) TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..)
wxString m_LibRef; /* Name of the module in library (and wxString m_LibRef; /* Name of the module in library (and
* the default value when loading a * the default value when loading a
*module from the library) */ * module from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot wxString m_AlternateReference; /* Used when m_Reference cannot
* be used to identify the * be used to identify the
* footprint ( after a full * footprint ( after a full
...@@ -55,28 +49,20 @@ public: ...@@ -55,28 +49,20 @@ public:
int m_Attributs; /* Flag bits ( see Mod_Attribut ) */ int m_Attributs; /* Flag bits ( see Mod_Attribut ) */
int m_Orient; /* orientation in 0.1 degrees */ int m_Orient; /* orientation in 0.1 degrees */
int flag; /* Use to trace ratsnest and auto int flag; /* Use to trace ratsnest and auto routing. */
* routing. */ int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
* AUTOPLACED) */
EDA_RECT m_BoundaryBox; /* Bounding box : coordinates on board,
* real orientation */
int m_PadNum; // Pad count int m_PadNum; // Pad count
int m_AltPadNum; /* Pad with netcode > 0 (active pads) int m_AltPadNum; /* Pad with netcode > 0 (active pads) count */
* count */
int m_CntRot90; /* Automatic placement : cost ( 0..10 ) int m_CntRot90; /* Automatic placement : cost ( 0..10 )
* for 90 degrees rotation * for 90 degrees rotation (Horiz<->Vertical) */
* (Horiz<->Vertical) */
int m_CntRot180; /* Automatic placement : cost ( 0..10 ) int m_CntRot180; /* Automatic placement : cost ( 0..10 )
* for 180 degrees rotation * for 180 degrees rotation (UP <->Down) */
* (UP <->Down) */ wxSize m_Ext; /* Automatic placement margin around the module */
wxSize m_Ext; /* Automatic placement margin around double m_Surface; // Bounding box area
* the module */
double m_Surface; // Bounding box area unsigned long m_Link; /* Temporary variable ( used in editions, ...) */
unsigned long m_Link; /* Temporary variable ( used in
* editions, ...) */
long m_LastEdit_Time; long m_LastEdit_Time;
wxString m_Path; wxString m_Path;
...@@ -240,7 +226,7 @@ public: ...@@ -240,7 +226,7 @@ public:
int aDrawMode, int aDrawMode,
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( EDA_3D_CANVAS* glcanvas );
void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode ); void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode );
......
/**********************************/ /**
/* class_pad.h : Pads description */ * @file class_pad.h
/**********************************/ * @brief Pad object description
*/
#ifndef _PAD_H_ #ifndef _PAD_H_
#define _PAD_H_ #define _PAD_H_
class Pcb3D_GLCanvas;
#include "pad_shapes.h" #include "pad_shapes.h"
#include "PolyLine.h" #include "PolyLine.h"
#include "richio.h" #include "richio.h"
class EDA_3D_CANVAS;
/* Default layers used for pads, according to the pad type. /* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad * this is default values only, they can be changed for a given pad
*/ */
...@@ -35,23 +38,25 @@ class Pcb3D_GLCanvas; ...@@ -35,23 +38,25 @@ class Pcb3D_GLCanvas;
class PAD_DRAWINFO class PAD_DRAWINFO
{ {
public: public:
EDA_DRAW_PANEL * m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null EDA_DRAW_PANEL* m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null
int m_DrawMode; // the draw mode int m_DrawMode; // the draw mode
int m_Color; // color used to draw the pad shape , from pad layers and int m_Color; // color used to draw the pad shape , from pad layers and
// visible layers // visible layers
int m_HoleColor; // color used to draw the pad hole int m_HoleColor; // color used to draw the pad hole
int m_NPHoleColor; // color used to draw a pad Not Plated hole int m_NPHoleColor; // color used to draw a pad Not Plated hole
int m_PadClearance; // clearance value, used to draw the pad area outlines int m_PadClearance; // clearance value, used to draw the pad area outlines
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
bool m_Display_padnum; // true to show pad number bool m_Display_padnum; // true to show pad number
bool m_Display_netname; // true to show net name bool m_Display_netname; // true to show net name
bool m_ShowPadFilled; // true to show pad as solid area, false to show pas in sketch mode bool m_ShowPadFilled; // true to show pad as solid area, false to show pas in
bool m_ShowNCMark; // true to show pad not connected mark // sketch mode
bool m_ShowNotPlatedHole; // true when the pad hole in not plated, to draw a specifib pad shape bool m_ShowNCMark; // true to show pad not connected mark
bool m_IsPrinting; // true to print, false to display on screen. bool m_ShowNotPlatedHole; // true when the pad hole in not plated, to draw a specific
wxPoint m_Offset; // general draw offset // pad shape
bool m_IsPrinting; // true to print, false to display on screen.
PAD_DRAWINFO( ); wxPoint m_Offset; // general draw offset
PAD_DRAWINFO();
}; };
...@@ -110,7 +115,7 @@ public: ...@@ -110,7 +115,7 @@ public:
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer) // (mode used to print pads on silkscreen layer)
int m_LengthDie; // Length net from pad to die on chip int m_LengthDie; // Length net from pad to die on chip
// Local clearance. When null, the module default value is used. // Local clearance. When null, the module default value is used.
// when the module default value is null, the netclass value is used // when the module default value is null, the netclass value is used
...@@ -121,11 +126,11 @@ public: ...@@ -121,11 +126,11 @@ public:
int m_LocalSolderMaskMargin; // Local solder mask margin int m_LocalSolderMaskMargin; // Local solder mask margin
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
private: private:
int m_SubRatsnest; // variable used in rats nest computations int m_SubRatsnest; // variable used in rats nest computations
// handle subnet (block) number in ratsnet connection // handle subnet (block) number in ratsnest connection
public: public:
D_PAD( MODULE* parent ); D_PAD( MODULE* parent );
...@@ -136,7 +141,6 @@ public: ...@@ -136,7 +141,6 @@ public:
D_PAD* Next() { return (D_PAD*) Pnext; } D_PAD* Next() { return (D_PAD*) Pnext; }
/** /**
* Function GetNetname * Function GetNetname
* @return const wxString * , a pointer to the full netname * @return const wxString * , a pointer to the full netname
...@@ -216,7 +220,7 @@ public: ...@@ -216,7 +220,7 @@ public:
* 2 - if null, the parent footprint value * 2 - if null, the parent footprint value
* 1 - if null, the global value * 1 - if null, the global value
*/ */
int GetSolderMaskMargin(); int GetSolderMaskMargin();
/** /**
* Function GetSolderPasteMargin * Function GetSolderPasteMargin
...@@ -228,10 +232,10 @@ public: ...@@ -228,10 +232,10 @@ public:
* 2 - if null, the parent footprint value * 2 - if null, the parent footprint value
* 1 - if null, the global value * 1 - if null, the global value
*/ */
wxSize GetSolderPasteMargin(); wxSize GetSolderPasteMargin();
/* Reading and writing data on files */ /* Reading and writing data on files */
int ReadDescr( LINE_READER* aReader ); int ReadDescr( LINE_READER* aReader );
/** /**
* Function Save * Function Save
...@@ -239,27 +243,28 @@ public: ...@@ -239,27 +243,28 @@ public:
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/* drawing functions */ /* drawing functions */
/** Draw a pad: /**
* Draw a pad:
* @param aPanel = the EDA_DRAW_PANEL panel * @param aPanel = the EDA_DRAW_PANEL panel
* @param aDC = the current device context * @param aDC = the current device context
* @param aDraw_mode = mode: GR_OR, GR_XOR, GR_AND... * @param aDraw_mode = mode: GR_OR, GR_XOR, GR_AND...
* @param aOffset = draw offset * @param aOffset = draw offset
*/ */
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int aDrawMode, const wxPoint& aOffset = ZeroOffset ); int aDrawMode, const wxPoint& aOffset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( EDA_3D_CANVAS* glcanvas );
/** /**
* Function DrawShape * Function DrawShape
* basic function to draw a pad. * basic function to draw a pad.
* used by Draw after calculation of parameters (color, ) final orientation ... * used by Draw after calculation of parameters (color, ) final orientation ...
*/ */
void DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ); void DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo );
/** /**
* Function BuildPadPolygon * Function BuildPadPolygon
...@@ -271,7 +276,7 @@ public: ...@@ -271,7 +276,7 @@ public:
* inflate, < 0 deflate * inflate, < 0 deflate
* @param aRotation = full rotation of the polygon * @param aRotation = full rotation of the polygon
*/ */
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const; void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const;
/** /**
* Function BuildSegmentFromOvalShape * Function BuildSegmentFromOvalShape
...@@ -288,12 +293,15 @@ public: ...@@ -288,12 +293,15 @@ public:
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const; int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
// others // others
void SetPadName( const wxString& name ); // Change pad name void SetPadName( const wxString& name ); // Change pad name
wxString ReturnStringPadName() const; // Return pad name as string in a wxString
wxString ReturnStringPadName() const; // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
void ComputeShapeMaxRadius(); // compute radius
int GetMaxRadius() const; void ComputeShapeMaxRadius(); // compute radius
int GetMaxRadius() const;
const wxPoint ReturnShapePos(); const wxPoint ReturnShapePos();
...@@ -302,6 +310,7 @@ public: ...@@ -302,6 +310,7 @@ public:
* @return int - the netcode * @return int - the netcode
*/ */
int GetSubRatsnest() const { return m_SubRatsnest; } int GetSubRatsnest() const { return m_SubRatsnest; }
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
...@@ -347,7 +356,7 @@ public: ...@@ -347,7 +356,7 @@ public:
* returns the bounding box of this pad * returns the bounding box of this pad
* Mainly used to redraw the screen area occupied by the pad * Mainly used to redraw the screen area occupied by the pad
*/ */
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** /**
* Function Compare * Function Compare
...@@ -389,7 +398,7 @@ public: ...@@ -389,7 +398,7 @@ public:
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
virtual void Show( int nestLevel, std::ostream& os ); virtual void Show( int nestLevel, std::ostream& os );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment