Loading 3d-viewer/3d_canvas.cpp +32 −2 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,34 @@ #include "bitmaps.h" #include "bitmaps.h" // ----------------- // helper function (from wxWidgets, opengl/cube.cpp sample // ----------------- void CheckGLError() { GLenum errLast = GL_NO_ERROR; for ( ;; ) { GLenum err = glGetError(); if ( err == GL_NO_ERROR ) return; // normally the error is reset by the call to glGetError() but if // glGetError() itself returns an error, we risk looping forever here // so check that we get a different error than the last time if ( err == errLast ) { wxLogError(wxT("OpenGL error state couldn't be reset.")); return; } errLast = err; wxLogError(wxT("OpenGL error %d"), err); } } /* /* * Pcb3D_GLCanvas implementation * Pcb3D_GLCanvas implementation */ */ Loading Loading @@ -538,6 +566,8 @@ void Pcb3D_GLCanvas::InitGL() // Setup light souces: // Setup light souces: SetLights(); SetLights(); CheckGLError(); } } Loading 3d-viewer/3d_draw.cpp +22 −39 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,8 @@ #error Please set wxUSE_GLCANVAS to 1 in setup.h. #error Please set wxUSE_GLCANVAS to 1 in setup.h. #endif #endif extern void CheckGLError(); static void Draw3D_FilledCircle( double posx, double posy, double rayon, static void Draw3D_FilledCircle( double posx, double posy, double rayon, double hole_rayon, double zpos ); double hole_rayon, double zpos ); static void Draw3D_FilledSegment( double startx, double starty, static void Draw3D_FilledSegment( double startx, double starty, Loading Loading @@ -348,9 +350,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() glEndList(); glEndList(); /* Test for errors */ /* Test for errors */ GLenum err = glGetError(); CheckGLError(); if( err != GL_NO_ERROR ) DisplayError( this, wxT( "Error in GL commands" ) ); return m_gllist; return m_gllist; } } Loading Loading @@ -786,8 +787,6 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) delta_cx, delta_cy, delta_cx, delta_cy, xc, yc; xc, yc; int angle, delta_angle; int angle, delta_angle; int coord[4][2]; double fcoord[8][2], f_hole_coord[8][2]; double scale; double scale; double zpos; double zpos; wxPoint shape_pos; wxPoint shape_pos; Loading Loading @@ -917,33 +916,18 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) break; break; case PAD_RECT: case PAD_RECT: case PAD_TRAPEZOID: case PAD_TRAPEZOID: { { int ddx, ddy; wxPoint coord[5]; ddx = m_DeltaSize.x >> 1; wxRealPoint fcoord[8], f_hole_coord[8]; ddy = m_DeltaSize.y >> 1; BuildPadPolygon( coord, wxSize(0,0), angle ); coord[0][0] = -dx - ddy; coord[0][1] = +dy + ddx; coord[1][0] = -dx + ddy; coord[1][1] = -dy - ddx; coord[2][0] = +dx - ddy; coord[2][1] = -dy + ddx; coord[3][0] = +dx + ddy; coord[3][1] = +dy - ddx; for( ii = 0; ii < 4; ii++ ) for( ii = 0; ii < 4; ii++ ) { { RotatePoint( &coord[ii][0], &coord[ii][1], angle ); coord[ii].x += ux0; coord[ii][0] += ux0; coord[ii].y += uy0; coord[ii][1] += uy0; ll = ii * 2; ll = ii * 2; fcoord[ll][0] = coord[ii][0] *scale; fcoord[ll].x = coord[ii].x *scale; fcoord[ll][1] = coord[ii][1] *scale; fcoord[ll].y = coord[ii].y *scale; } } for( ii = 0; ii < 7; ii += 2 ) for( ii = 0; ii < 7; ii += 2 ) Loading @@ -951,18 +935,17 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ll = ii + 2; ll = ii + 2; if( ll > 7 ) if( ll > 7 ) ll -= 8; ll -= 8; fcoord[ii + 1][0] = (fcoord[ii][0] + fcoord[ll][0]) / 2; fcoord[ii + 1].x = (fcoord[ii].x + fcoord[ll].x) / 2; fcoord[ii + 1][1] = (fcoord[ii][1] + fcoord[ll][1]) / 2; fcoord[ii + 1].y = (fcoord[ii].y + fcoord[ll].y) / 2; } } for( ii = 0; ii < 8; ii++ ) for( ii = 0; ii < 8; ii++ ) { { f_hole_coord[ii][0] = -hole * 0.707; f_hole_coord[ii].x = -hole * 0.707; f_hole_coord[ii][1] = hole * 0.707; f_hole_coord[ii].y = hole * 0.707; RotatePoint( &f_hole_coord[ii][0], &f_hole_coord[ii][1], RotatePoint( &f_hole_coord[ii].x, &f_hole_coord[ii].y, angle - (ii * 450) ); angle - (ii * 450) ); f_hole_coord[ii].x += drillx; f_hole_coord[ii][0] += drillx; f_hole_coord[ii].y += drilly; f_hole_coord[ii][1] += drilly; } } for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) Loading Loading @@ -991,12 +974,12 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP ); for( ii = 0; ii < 8; ii++ ) for( ii = 0; ii < 8; ii++ ) { { glVertex3f( f_hole_coord[ii][0], -f_hole_coord[ii][1], zpos ); glVertex3f( f_hole_coord[ii].x, -f_hole_coord[ii].y, zpos ); glVertex3f( fcoord[ii][0], -fcoord[ii][1], zpos ); glVertex3f( fcoord[ii].x, -fcoord[ii].y, zpos ); } } glVertex3f( f_hole_coord[0][0], -f_hole_coord[0][1], zpos ); glVertex3f( f_hole_coord[0].x, -f_hole_coord[0].y, zpos ); glVertex3f( fcoord[0][0], -fcoord[0][1], zpos ); glVertex3f( fcoord[0].x, -fcoord[0].y, zpos ); glEnd(); glEnd(); } } } } Loading bitmaps/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,7 @@ set(BITMAP_SRCS icon_pcbnew.xpm icon_pcbnew.xpm icon_txt.xpm icon_txt.xpm import3d.xpm import3d.xpm import_cmp_from_lib.xpm import_hierarchical_label.xpm import_hierarchical_label.xpm Import_Module.xpm Import_Module.xpm import.xpm import.xpm Loading bitmaps/import_cmp_from_lib.xpm 0 → 100644 +38 −0 Original line number Original line Diff line number Diff line /* XPM */ const char *import_cmp_from_lib_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 16 1", "O c #76787C", "$ c #979A9C", "= c #404440", "; c #ACB1B5", "# c #04BA04", "+ c #CACCCC", "o c #F5F6F7", ". c #2E3031", " c None", "* c #124912", "@ c #049304", "& c #505355", "X c #0C290C", "% c #046404", "- c #DADBDB", ": c #83888C", /* pixels */ " .X ", " ooO ", " +o++. ", " @#X$++.$ ", " %#@X$+X.& ", " *##@%%%%=&.=.. ", " OX######%Oooo-.", " $&*@@##%Ooo-; ", " :;+:&%@&ooo+: ", " O;+$*=-oo-;X ", " =:$+.oooo+O ", " &O-+oooo; ", " X&++--o+: ", " .=O$$$ ", " .XX ", " " }; common/drawframe.cpp +14 −8 Original line number Original line Diff line number Diff line Loading @@ -633,37 +633,43 @@ void WinEDA_DrawFrame::UpdateStatusBar() } } /* The following sadly is an if eeschema/if pcbnew */ /* The following sadly is an if eeschema/if pcbnew */ wxString formatter; wxString absformatter; wxString locformatter; switch( g_UserUnit ) switch( g_UserUnit ) { { case INCHES: case INCHES: if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) { { formatter = wxT( "X %.3f Y %.3f" ); absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" ); } } else else { { formatter = wxT( "X %.4f Y %.4f" ); absformatter = wxT( "X %.4f Y %.4f" ); locformatter = wxT( "dx %.4f dy %.4f" ); } } break; break; case MILLIMETRES: case MILLIMETRES: if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) { { formatter = wxT( "X %.2f Y %.2f" ); absformatter = wxT( "X %.2f Y %.2f" ); locformatter = wxT( "dx %.2f dy %.2f" ); } } else else { { formatter = wxT( "X %.3f Y %.3f" ); absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" ); } } break; break; case UNSCALED_UNITS: case UNSCALED_UNITS: formatter = wxT( "X %f Y %f" ); absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f" ); break; break; } } Line.Printf( formatter, dXpos, dYpos ); Line.Printf( absformatter, dXpos, dYpos ); SetStatusText( Line, 2 ); SetStatusText( Line, 2 ); /* Display relative coordinates: */ /* Display relative coordinates: */ Loading @@ -678,7 +684,7 @@ void WinEDA_DrawFrame::UpdateStatusBar() } } /* We already decided the formatter above */ /* We already decided the formatter above */ Line.Printf( formatter, dXpos, dYpos ); Line.Printf( locformatter, dXpos, dYpos ); SetStatusText( Line, 3 ); SetStatusText( Line, 3 ); } } Loading Loading
3d-viewer/3d_canvas.cpp +32 −2 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,34 @@ #include "bitmaps.h" #include "bitmaps.h" // ----------------- // helper function (from wxWidgets, opengl/cube.cpp sample // ----------------- void CheckGLError() { GLenum errLast = GL_NO_ERROR; for ( ;; ) { GLenum err = glGetError(); if ( err == GL_NO_ERROR ) return; // normally the error is reset by the call to glGetError() but if // glGetError() itself returns an error, we risk looping forever here // so check that we get a different error than the last time if ( err == errLast ) { wxLogError(wxT("OpenGL error state couldn't be reset.")); return; } errLast = err; wxLogError(wxT("OpenGL error %d"), err); } } /* /* * Pcb3D_GLCanvas implementation * Pcb3D_GLCanvas implementation */ */ Loading Loading @@ -538,6 +566,8 @@ void Pcb3D_GLCanvas::InitGL() // Setup light souces: // Setup light souces: SetLights(); SetLights(); CheckGLError(); } } Loading
3d-viewer/3d_draw.cpp +22 −39 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,8 @@ #error Please set wxUSE_GLCANVAS to 1 in setup.h. #error Please set wxUSE_GLCANVAS to 1 in setup.h. #endif #endif extern void CheckGLError(); static void Draw3D_FilledCircle( double posx, double posy, double rayon, static void Draw3D_FilledCircle( double posx, double posy, double rayon, double hole_rayon, double zpos ); double hole_rayon, double zpos ); static void Draw3D_FilledSegment( double startx, double starty, static void Draw3D_FilledSegment( double startx, double starty, Loading Loading @@ -348,9 +350,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() glEndList(); glEndList(); /* Test for errors */ /* Test for errors */ GLenum err = glGetError(); CheckGLError(); if( err != GL_NO_ERROR ) DisplayError( this, wxT( "Error in GL commands" ) ); return m_gllist; return m_gllist; } } Loading Loading @@ -786,8 +787,6 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) delta_cx, delta_cy, delta_cx, delta_cy, xc, yc; xc, yc; int angle, delta_angle; int angle, delta_angle; int coord[4][2]; double fcoord[8][2], f_hole_coord[8][2]; double scale; double scale; double zpos; double zpos; wxPoint shape_pos; wxPoint shape_pos; Loading Loading @@ -917,33 +916,18 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) break; break; case PAD_RECT: case PAD_RECT: case PAD_TRAPEZOID: case PAD_TRAPEZOID: { { int ddx, ddy; wxPoint coord[5]; ddx = m_DeltaSize.x >> 1; wxRealPoint fcoord[8], f_hole_coord[8]; ddy = m_DeltaSize.y >> 1; BuildPadPolygon( coord, wxSize(0,0), angle ); coord[0][0] = -dx - ddy; coord[0][1] = +dy + ddx; coord[1][0] = -dx + ddy; coord[1][1] = -dy - ddx; coord[2][0] = +dx - ddy; coord[2][1] = -dy + ddx; coord[3][0] = +dx + ddy; coord[3][1] = +dy - ddx; for( ii = 0; ii < 4; ii++ ) for( ii = 0; ii < 4; ii++ ) { { RotatePoint( &coord[ii][0], &coord[ii][1], angle ); coord[ii].x += ux0; coord[ii][0] += ux0; coord[ii].y += uy0; coord[ii][1] += uy0; ll = ii * 2; ll = ii * 2; fcoord[ll][0] = coord[ii][0] *scale; fcoord[ll].x = coord[ii].x *scale; fcoord[ll][1] = coord[ii][1] *scale; fcoord[ll].y = coord[ii].y *scale; } } for( ii = 0; ii < 7; ii += 2 ) for( ii = 0; ii < 7; ii += 2 ) Loading @@ -951,18 +935,17 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) ll = ii + 2; ll = ii + 2; if( ll > 7 ) if( ll > 7 ) ll -= 8; ll -= 8; fcoord[ii + 1][0] = (fcoord[ii][0] + fcoord[ll][0]) / 2; fcoord[ii + 1].x = (fcoord[ii].x + fcoord[ll].x) / 2; fcoord[ii + 1][1] = (fcoord[ii][1] + fcoord[ll][1]) / 2; fcoord[ii + 1].y = (fcoord[ii].y + fcoord[ll].y) / 2; } } for( ii = 0; ii < 8; ii++ ) for( ii = 0; ii < 8; ii++ ) { { f_hole_coord[ii][0] = -hole * 0.707; f_hole_coord[ii].x = -hole * 0.707; f_hole_coord[ii][1] = hole * 0.707; f_hole_coord[ii].y = hole * 0.707; RotatePoint( &f_hole_coord[ii][0], &f_hole_coord[ii][1], RotatePoint( &f_hole_coord[ii].x, &f_hole_coord[ii].y, angle - (ii * 450) ); angle - (ii * 450) ); f_hole_coord[ii].x += drillx; f_hole_coord[ii][0] += drillx; f_hole_coord[ii].y += drilly; f_hole_coord[ii][1] += drilly; } } for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) Loading Loading @@ -991,12 +974,12 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas ) glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP ); for( ii = 0; ii < 8; ii++ ) for( ii = 0; ii < 8; ii++ ) { { glVertex3f( f_hole_coord[ii][0], -f_hole_coord[ii][1], zpos ); glVertex3f( f_hole_coord[ii].x, -f_hole_coord[ii].y, zpos ); glVertex3f( fcoord[ii][0], -fcoord[ii][1], zpos ); glVertex3f( fcoord[ii].x, -fcoord[ii].y, zpos ); } } glVertex3f( f_hole_coord[0][0], -f_hole_coord[0][1], zpos ); glVertex3f( f_hole_coord[0].x, -f_hole_coord[0].y, zpos ); glVertex3f( fcoord[0][0], -fcoord[0][1], zpos ); glVertex3f( fcoord[0].x, -fcoord[0].y, zpos ); glEnd(); glEnd(); } } } } Loading
bitmaps/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,7 @@ set(BITMAP_SRCS icon_pcbnew.xpm icon_pcbnew.xpm icon_txt.xpm icon_txt.xpm import3d.xpm import3d.xpm import_cmp_from_lib.xpm import_hierarchical_label.xpm import_hierarchical_label.xpm Import_Module.xpm Import_Module.xpm import.xpm import.xpm Loading
bitmaps/import_cmp_from_lib.xpm 0 → 100644 +38 −0 Original line number Original line Diff line number Diff line /* XPM */ const char *import_cmp_from_lib_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 16 1", "O c #76787C", "$ c #979A9C", "= c #404440", "; c #ACB1B5", "# c #04BA04", "+ c #CACCCC", "o c #F5F6F7", ". c #2E3031", " c None", "* c #124912", "@ c #049304", "& c #505355", "X c #0C290C", "% c #046404", "- c #DADBDB", ": c #83888C", /* pixels */ " .X ", " ooO ", " +o++. ", " @#X$++.$ ", " %#@X$+X.& ", " *##@%%%%=&.=.. ", " OX######%Oooo-.", " $&*@@##%Ooo-; ", " :;+:&%@&ooo+: ", " O;+$*=-oo-;X ", " =:$+.oooo+O ", " &O-+oooo; ", " X&++--o+: ", " .=O$$$ ", " .XX ", " " };
common/drawframe.cpp +14 −8 Original line number Original line Diff line number Diff line Loading @@ -633,37 +633,43 @@ void WinEDA_DrawFrame::UpdateStatusBar() } } /* The following sadly is an if eeschema/if pcbnew */ /* The following sadly is an if eeschema/if pcbnew */ wxString formatter; wxString absformatter; wxString locformatter; switch( g_UserUnit ) switch( g_UserUnit ) { { case INCHES: case INCHES: if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) { { formatter = wxT( "X %.3f Y %.3f" ); absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" ); } } else else { { formatter = wxT( "X %.4f Y %.4f" ); absformatter = wxT( "X %.4f Y %.4f" ); locformatter = wxT( "dx %.4f dy %.4f" ); } } break; break; case MILLIMETRES: case MILLIMETRES: if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) { { formatter = wxT( "X %.2f Y %.2f" ); absformatter = wxT( "X %.2f Y %.2f" ); locformatter = wxT( "dx %.2f dy %.2f" ); } } else else { { formatter = wxT( "X %.3f Y %.3f" ); absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" ); } } break; break; case UNSCALED_UNITS: case UNSCALED_UNITS: formatter = wxT( "X %f Y %f" ); absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f" ); break; break; } } Line.Printf( formatter, dXpos, dYpos ); Line.Printf( absformatter, dXpos, dYpos ); SetStatusText( Line, 2 ); SetStatusText( Line, 2 ); /* Display relative coordinates: */ /* Display relative coordinates: */ Loading @@ -678,7 +684,7 @@ void WinEDA_DrawFrame::UpdateStatusBar() } } /* We already decided the formatter above */ /* We already decided the formatter above */ Line.Printf( formatter, dXpos, dYpos ); Line.Printf( locformatter, dXpos, dYpos ); SetStatusText( Line, 3 ); SetStatusText( Line, 3 ); } } Loading