Commit 689579bd authored by stambaughw's avatar stambaughw
Browse files

Global variable unobfuscation, new library path search, and lots of other...

Global variable unobfuscation, new library path search, and lots of other changes.  See CHANGELOG.txt.
parent 7a351249
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include "wx/dataobj.h"
#include "wx/clipbrd.h"

#include "fctsys.h"
#include "id.h"
#include "gestfich.h"

@@ -620,6 +619,7 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
 *  Output file format is png or jpeg, or image is copied on clipboard
 */
{
    wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
    wxString FullFileName;
    wxString file_ext, mask;
    bool     fmt_is_jpeg = FALSE;
@@ -628,15 +628,15 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
        fmt_is_jpeg = TRUE;
    if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
    {
        file_ext = fmt_is_jpeg ? wxT( ".jpg" ) : wxT( ".png"; )
                   mask = wxT( "*" ) + file_ext;
        file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png"; )
                   mask = wxT( "*." ) + file_ext;
        FullFileName    = m_Parent->m_Parent->GetScreen()->m_FileName;
        ChangeFileNameExt( FullFileName, file_ext );
        fn.SetExt( file_ext );

        FullFileName =
            EDA_FileSelector( _( "3D Image filename:" ),
                              wxEmptyString,    /* Chemin par defaut */
                              FullFileName,     /* nom fichier par defaut */
                              fn.GetFullName(), /* nom fichier par defaut */
                              file_ext,         /* extension par defaut */
                              mask,             /* Masque d'affichage */
                              this,
+16 −4
Original line number Diff line number Diff line
@@ -20,12 +20,24 @@
#include "bitmaps.h"
#include "id.h"

#define VIEWER_MAIN
#include "3d_viewer.h"
#include "trackball.h"

#include <wx/colordlg.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

int gl_attrib[] =
{
    WX_GL_RGBA, WX_GL_MIN_RED, 8, WX_GL_MIN_GREEN, 8, WX_GL_MIN_BLUE, 8,
    WX_GL_DEPTH_SIZE, 16, WX_GL_DOUBLEBUFFER, GL_NONE
};


BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
    EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
@@ -358,9 +370,9 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
    S3D_Color color;
    wxColour  newcolor, oldcolor;

    oldcolor.Set( (int) round( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
        (int) round( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
        (int) round( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
    oldcolor.Set( wxRound( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
                  wxRound( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
                  wxRound( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );

    newcolor = wxGetColourFromUser( this, oldcolor );
    if( newcolor != oldcolor )
+23 −17
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "common.h"
#include "macros.h"
#include "kicad_string.h"
#include "appl_wxstruct.h"

#include "3d_struct.h"
#include "3d_viewer.h"
@@ -23,7 +24,8 @@ int S3D_MASTER:: ReadData()
/************************************/
{
    char       line[1024], * text;
    wxString fullfilename;
    wxFileName fn;
    wxString   tmp;
    FILE*      file;
    int        LineNum = 0;

@@ -32,20 +34,24 @@ int S3D_MASTER:: ReadData()
        return 1;
    }

    if( wxIsAbsolutePath( m_Shape3DName ) )
        fullfilename.Empty();
    else
        fullfilename = g_RealLibDirBuffer + LIB3D_PATH;
    fullfilename += m_Shape3DName;
#if defined (__WINDOWS__)
    fullfilename.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
#else
#if defined (__UNIX__)
    fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
#endif
#endif
    fn = m_Shape3DName;

    if( !fn.FileExists() )
    {
        tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullPath() );

        if( !tmp )
        {
            wxLogDebug( _( "3D part library <%s> could not be found." ),
                        fn.GetFullPath().c_str() );
            return -1;
        }

        fn = tmp;
    }

    file = wxFopen( fn.GetFullPath(), wxT( "rt" ) );

    file = wxFopen( fullfilename, wxT( "rt" ) );
    if( file == NULL )
    {
        return -1;
+40 −33
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@

#include "id.h"

#define BITMAP wxBitmap
#include "3d_viewer.h"


@@ -29,63 +28,71 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
    SetToolBar( m_HToolBar );

    // Set up toolbar
    m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, BITMAP( import3d_xpm ),
    m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
                         wxBitmap( import3d_xpm ),
                         _( "Reload board" ) );
#ifdef __WINDOWS__  // do not work properly under linux
    m_HToolBar-> AddSeparator();

    m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString, BITMAP( copy_button ),
    m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
                         wxBitmap( copy_button ),
                        _( "Copy 3D Image to Clipboard" ) );
#endif

    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, BITMAP( zoom_in_xpm ),
    m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
                         _( "Zoom in" ) );

    m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, BITMAP( zoom_out_xpm ),
    m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
                         _( "Zoom out" ) );

    m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, BITMAP( zoom_redraw_xpm ),
    m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
                         wxBitmap( zoom_redraw_xpm ),
                         _( "Redraw view" ) );

    m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, BITMAP( zoom_auto_xpm ),
    m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
                         _( "Zoom auto" ) );

    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString, BITMAP( rotate_neg_X_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
                         wxBitmap( rotate_neg_X_xpm ),
                         _( "Rotate X <-" ) );

    m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString, BITMAP( rotate_pos_X_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
                         wxBitmap( rotate_pos_X_xpm ),
                         _( "Rotate X ->" ) );

    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString, BITMAP( rotate_neg_Y_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
                         wxBitmap( rotate_neg_Y_xpm ),
                         _( "Rotate Y <-" ) );

    m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString, BITMAP( rotate_pos_Y_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
                         wxBitmap( rotate_pos_Y_xpm ),
                         _( "Rotate Y ->" ) );

    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString, BITMAP( rotate_neg_Z_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
                         wxBitmap( rotate_neg_Z_xpm ),
                         _( "Rotate Z <-" ) );

    m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString, BITMAP( rotate_pos_Z_xpm ),
    m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
                         wxBitmap( rotate_pos_Z_xpm ),
                         _( "Rotate Z ->" ) );

    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, BITMAP( left_xpm ),
    m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, wxBitmap( left_xpm ),
                         _( "Move left <-" ) );

    m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, BITMAP( right_xpm ),
    m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, wxBitmap( right_xpm ),
                         _( "Move right ->" ) );

    m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, BITMAP( up_xpm ),
    m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
                         _( "Move Up ^" ) );

    m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, BITMAP( down_xpm ),
    m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
                         _( "Move Down" ) );


    m_HToolBar->Realize();

//	SetToolbars();
+98 −113
Original line number Diff line number Diff line
@@ -20,12 +20,6 @@
#  include <GL/glu.h>
#endif

#ifdef VIEWER_MAIN
#define global_3d
#else
#define global_3d extern
#endif

#include "pcbstruct.h"
#include "3d_struct.h"

@@ -175,17 +169,8 @@ public:
void SetGLColor(int color);
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );

global_3d  Info_3D_Visu g_Parm_3D_Visu;
global_3d double g_Draw3d_dx, g_Draw3d_dy;
global_3d double ZBottom, ZTop;
global_3d double DataScale3D;		// coeff de conversion unites utilsateut -> unites 3D
global_3d int gl_attrib[]
#ifdef VIEWER_MAIN
= { WX_GL_RGBA, WX_GL_MIN_RED, 8, WX_GL_MIN_GREEN, 8,
            WX_GL_MIN_BLUE, 8, WX_GL_DEPTH_SIZE, 16,
            WX_GL_DOUBLEBUFFER,
			GL_NONE }
#endif
;

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[];
Loading