Commit b1d1a711 authored by charras's avatar charras
Browse files

Finished code cleaning about ratsnets calculations and handling.

Minor others changes.
parent 8f36c1fc
Loading
Loading
Loading
Loading
+28 −17
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/
{
    wxPaintDC dc( this );

    // Set the OpenGL viewport according to the client size of this canvas.
    // This is done here rather than in a wxSizeEvent handler because our
    // OpenGL rendering context (and thus viewport setting) is used with
@@ -488,7 +489,6 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
}



/***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
/***********************************************************/
@@ -627,13 +627,26 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
    }

    Redraw( true );
    wxSize     image_size = GetClientSize();
    wxClientDC dc( this );
    wxBitmap   bitmap( image_size.x, image_size.y );
    wxMemoryDC memdc;
    memdc.SelectObject( bitmap );
    memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
    memdc.SelectObject( wxNullBitmap );

    struct vieport_params
    {
        GLint originx;
        GLint originy;
        GLint x;
        GLint y;
    } viewport;

    glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );

    unsigned char* pixelbuffer = (unsigned char*) malloc( 3 * viewport.x * viewport.y );
    glReadPixels( 0, 0, viewport.x, viewport.y, GL_RGB, GL_UNSIGNED_BYTE, pixelbuffer );

    wxImage        image( viewport.x, viewport.y );

    image.SetData( pixelbuffer );
    image = image.Mirror();
    image = image.Rotate90().Rotate90();
    wxBitmap bitmap( image, -1 );

    if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
    {
@@ -650,8 +663,6 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
    }
    else
    {
        wxImage image = bitmap.ConvertToImage();

        if( !image.SaveFile( FullFileName,
                             fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
            wxLogError( wxT( "Can't save file" ) );
+32 −15
Original line number Diff line number Diff line
//////////////////////////////////////

// Name:        3d_draw.cpp
//////////////////////////////////////


#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif

#include "fctsys.h"
#include "common.h"
#include "trigo.h"


#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif

#include "pcbstruct.h"
#include "macros.h"
#include "drawtxt.h"
@@ -27,6 +15,11 @@

#include "3d_struct.h"

#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif


static void Draw3D_FilledCircle( double posx, double posy,
                                 double rayon, double hole_rayon, double zpos );
static void Draw3D_FilledSegment( double startx, double starty,
@@ -489,6 +482,30 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
    s_Text3DZPos  = g_Parm_3D_Visu.m_LayerZcoord[layer];
    s_Text3DWidth = text->m_Width * g_Parm_3D_Visu.m_BoardScale;
    glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
    if( text->m_MultilineAllowed )
    {
        wxPoint        pos  = text->m_Pos;
        wxArrayString* list = wxStringSplit( text->m_Text, '\n' );
        wxPoint        offset;

        offset.y = text->GetInterline();

        RotatePoint( &offset, text->m_Orient );
        for( unsigned i = 0; i<list->Count(); i++ )
        {
            wxString txt = list->Item( i );
            DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
                     txt, text->m_Orient, text->m_Size,
                     text->m_HJustify, text->m_VJustify,
                     text->m_Width, text->m_Italic,
                     true,
                     Draw3dTextSegm );
            pos += offset;
        }

        delete (list);
    }
    else
        DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
                     text->m_Text, text->m_Orient, text->m_Size,
                     text->m_HJustify, text->m_VJustify,
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
    m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
                         wxBitmap( import3d_xpm ),
                         _( "Reload board" ) );
#ifdef __WINDOWS__  // do not work properly under linux
#if (defined(__WINDOWS__) || defined(__APPLE__))  // do not work properly under linux
    m_HToolBar-> AddSeparator();

    m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
+8 −0
Original line number Diff line number Diff line
@@ -4,6 +4,14 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.


2009-may-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
    Finished code cleaning about ratsnets calculations and handling
    Obscure code removed ( I hope)
    Better names for some members of BOARD class.

2009-may-24 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"


#define BUILD_VERSION wxT("(20090513-unstable)")
#define BUILD_VERSION wxT("(20090525-unstable)")

wxString g_BuildVersion

Loading