3d viewer: code cleaning. Display options are now stored in config.
This commit is contained in:
parent
97ea4e83f7
commit
4b14415596
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include <class_pcb_text.h>
|
#include <class_pcb_text.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
#include <3d_canvas.h>
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
#include <3d_canvas.h>
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
#include <3d_viewer_id.h>
|
#include <3d_viewer_id.h>
|
||||||
|
@ -73,12 +74,11 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
|
EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
|
||||||
wxGLCanvas( parent, -1, attribList, wxDefaultPosition, wxDefaultSize,
|
wxGLCanvas( parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
|
||||||
wxFULL_REPAINT_ON_RESIZE )
|
wxFULL_REPAINT_ON_RESIZE )
|
||||||
{
|
{
|
||||||
m_init = false;
|
m_init = false;
|
||||||
m_gllist = 0;
|
m_gllist = 0;
|
||||||
m_ortho = false;
|
|
||||||
// Explicitly create a new rendering context instance for this canvas.
|
// Explicitly create a new rendering context instance for this canvas.
|
||||||
m_glRC = new wxGLContext( this );
|
m_glRC = new wxGLContext( this );
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ void EDA_3D_CANVAS::InitGL()
|
||||||
if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE )
|
if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE )
|
||||||
g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE;
|
g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE;
|
||||||
|
|
||||||
if( ModeIsOrtho() )
|
if( Parent()->ModeIsOrtho() )
|
||||||
{
|
{
|
||||||
// OrthoReductionFactor is chosen so as to provide roughly the same size as
|
// OrthoReductionFactor is chosen so as to provide roughly the same size as
|
||||||
// Perspective View
|
// Perspective View
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file 3d_viewer.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _3D_CANVAS_H_
|
||||||
|
#define _3D_CANVAS_H_
|
||||||
|
|
||||||
|
#include <wxBasePcbFrame.h> // for m_auimanager member.
|
||||||
|
#include <layers_id_colors_and_visibility.h> // Layers id definitions
|
||||||
|
#include <PolyLine.h> // for CPolyPt
|
||||||
|
|
||||||
|
#if !wxUSE_GLCANVAS
|
||||||
|
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/glcanvas.h>
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
# ifdef __DARWIN__
|
||||||
|
# include <OpenGL/glu.h>
|
||||||
|
# else
|
||||||
|
# include <glu.h>
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <3d_struct.h>
|
||||||
|
|
||||||
|
class BOARD_DESIGN_SETTINGS;
|
||||||
|
class TRACK;
|
||||||
|
class TEXTE_PCB;
|
||||||
|
class DRAWSEGMENT;
|
||||||
|
class ZONE_CONTAINER;
|
||||||
|
class EDA_3D_FRAME;
|
||||||
|
class S3D_VERTEX;
|
||||||
|
class SEGVIA;
|
||||||
|
|
||||||
|
|
||||||
|
class EDA_3D_CANVAS : public wxGLCanvas
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
bool m_init;
|
||||||
|
GLuint m_gllist;
|
||||||
|
wxGLContext* m_glRC;
|
||||||
|
wxRealPoint m_draw3dOffset; // offset to draw the 3 mesh.
|
||||||
|
double m_ZBottom; // position of the back layer
|
||||||
|
double m_ZTop; // position of the front layer
|
||||||
|
|
||||||
|
public:
|
||||||
|
EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList = 0 );
|
||||||
|
~EDA_3D_CANVAS();
|
||||||
|
|
||||||
|
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
|
||||||
|
|
||||||
|
void ClearLists();
|
||||||
|
|
||||||
|
// Event functions:
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
void OnEraseBackground( wxEraseEvent& event );
|
||||||
|
void OnChar( wxKeyEvent& event );
|
||||||
|
void OnMouseWheel( wxMouseEvent& event );
|
||||||
|
void OnMouseMove( wxMouseEvent& event );
|
||||||
|
void OnRightClick( wxMouseEvent& event );
|
||||||
|
void OnPopUpMenu( wxCommandEvent& event );
|
||||||
|
void TakeScreenshot( wxCommandEvent& event );
|
||||||
|
void OnEnterWindow( wxMouseEvent& event );
|
||||||
|
|
||||||
|
// Display functions
|
||||||
|
GLuint DisplayCubeforTest(); // Just a test function
|
||||||
|
void SetView3D( int keycode );
|
||||||
|
void DisplayStatus();
|
||||||
|
void Redraw( bool finish = false );
|
||||||
|
void Render();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CreateDrawGL_List
|
||||||
|
* creates the OpenGL draw list items.
|
||||||
|
*/
|
||||||
|
GLuint CreateDrawGL_List();
|
||||||
|
void InitGL();
|
||||||
|
void SetLights();
|
||||||
|
void SetOffset(double aPosX, double aPosY)
|
||||||
|
{
|
||||||
|
m_draw3dOffset.x = aPosX;
|
||||||
|
m_draw3dOffset.y = aPosY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawGrid( double aGriSizeMM );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Draw3D_Track
|
||||||
|
* @param aTrack = the aTrack to draw
|
||||||
|
*/
|
||||||
|
void Draw3D_Track( TRACK* aTrack );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Draw3D_Via
|
||||||
|
* draws 3D via as a cylinder and filled circles.
|
||||||
|
*/
|
||||||
|
void Draw3D_Via( SEGVIA* via );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Draw3D_DrawSegment
|
||||||
|
* draws a 3D segment (line, arc or circle).
|
||||||
|
*/
|
||||||
|
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Draw3D_Zone
|
||||||
|
* draw all solid areas in aZone
|
||||||
|
* @param aZone = the zone to draw
|
||||||
|
*/
|
||||||
|
void Draw3D_Zone( ZONE_CONTAINER* aZone );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Draw3D_DrawText
|
||||||
|
* draws 3D segments to create text objects.
|
||||||
|
* When DrawGraphicText is called to draw a text to an OpenGL DC
|
||||||
|
* it calls Draw3dTextSegm to each segment to draw.
|
||||||
|
* 2 parameters used by Draw3D_FilledSegment are not handled by DrawGraphicText
|
||||||
|
* but are used in Draw3D_FilledSegment().
|
||||||
|
* they are 2 local variables. This is an ugly, but trivial code.
|
||||||
|
* Using DrawGraphicText to draw all texts ensure texts have the same shape
|
||||||
|
* in all contexts
|
||||||
|
*/
|
||||||
|
void Draw3D_DrawText( TEXTE_PCB* text );
|
||||||
|
|
||||||
|
//int Get3DLayerEnable(int act_layer);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _3D_CANVAS_H_ */
|
|
@ -43,6 +43,7 @@
|
||||||
#include <convert_basic_shapes_to_polygon.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
#include <3d_canvas.h>
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
#include <3d_draw_basic_functions.h>
|
#include <3d_draw_basic_functions.h>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <appl_wxstruct.h>
|
#include <appl_wxstruct.h>
|
||||||
|
|
||||||
#include <3d_viewer.h>
|
#include <3d_viewer.h>
|
||||||
|
#include <3d_canvas.h>
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
|
|
||||||
|
@ -36,42 +37,59 @@
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <3d_viewer_id.h>
|
#include <3d_viewer_id.h>
|
||||||
|
|
||||||
INFO3D_VISU g_Parm_3D_Visu;
|
INFO3D_VISU g_Parm_3D_Visu;
|
||||||
|
|
||||||
|
// Key to store 3D Viewer config:
|
||||||
|
static const wxString keyPosx( wxT( "Pos_x" ) );
|
||||||
|
static const wxString keyPosy( wxT( "Pos_y" ) );
|
||||||
|
static const wxString keySizex( wxT( "Size_x" ) );
|
||||||
|
static const wxString keySizey( wxT( "Size_y" ) );
|
||||||
|
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
|
||||||
|
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
|
||||||
|
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
|
||||||
|
static const wxString keyShowAxis( wxT( "ShowAxis" ) );
|
||||||
|
static const wxString keyShowZones( wxT( "ShowZones" ) );
|
||||||
|
static const wxString keyShowFootprints( wxT( "ShowFootprints" ) );
|
||||||
|
static const wxString keyShowCopperThickness( wxT( "ShowCopperThickness" ) );
|
||||||
|
static const wxString keyShowCommetsLayer( wxT( "ShowCommetsLayer" ) );
|
||||||
|
static const wxString keyShowDrawingsLayer( wxT( "ShowDrawingsLayer" ) );
|
||||||
|
static const wxString keyShowEco1Layer( wxT( "ShowEco1Layer" ) );
|
||||||
|
static const wxString keyShowEco2Layer( wxT( "ShowEco2Layer" ) );
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame )
|
BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame )
|
||||||
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
||||||
|
|
||||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, EDA_3D_FRAME::Process_Zoom )
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, EDA_3D_FRAME::Process_Zoom )
|
||||||
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
|
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
|
||||||
EDA_3D_FRAME::Process_Special_Functions )
|
EDA_3D_FRAME::Process_Special_Functions )
|
||||||
EVT_MENU( wxID_EXIT, EDA_3D_FRAME::Exit3DFrame )
|
EVT_MENU( wxID_EXIT, EDA_3D_FRAME::Exit3DFrame )
|
||||||
EVT_MENU( ID_MENU_SCREENCOPY_PNG, EDA_3D_FRAME::Process_Special_Functions )
|
EVT_MENU( ID_MENU_SCREENCOPY_PNG, EDA_3D_FRAME::Process_Special_Functions )
|
||||||
EVT_MENU( ID_MENU_SCREENCOPY_JPEG, EDA_3D_FRAME::Process_Special_Functions )
|
EVT_MENU( ID_MENU_SCREENCOPY_JPEG, EDA_3D_FRAME::Process_Special_Functions )
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END,
|
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END,
|
||||||
EDA_3D_FRAME::On3DGridSelection )
|
EDA_3D_FRAME::On3DGridSelection )
|
||||||
|
|
||||||
EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
||||||
|
const wxString& title,
|
||||||
|
long style ) :
|
||||||
EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long style ) :
|
wxFrame( parent, DISPLAY3D_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style )
|
||||||
wxFrame( parent, DISPLAY3D_FRAME_TYPE, title, wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
|
|
||||||
{
|
{
|
||||||
m_FrameName = wxT( "Frame3D" );
|
m_frameName = wxT( "Frame3D" );
|
||||||
m_Canvas = NULL;
|
m_canvas = NULL;
|
||||||
m_HToolBar = NULL;
|
m_HToolBar = NULL;
|
||||||
m_VToolBar = NULL;
|
m_VToolBar = NULL;
|
||||||
m_reloadRequest = false;
|
m_reloadRequest = false;
|
||||||
|
m_ortho = false;
|
||||||
|
|
||||||
// Give it an icon
|
// Give it an icon
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
||||||
SetIcon( icon );
|
SetIcon( icon );
|
||||||
|
|
||||||
GetSettings();
|
GetSettings();
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||||
|
|
||||||
// Create the status line
|
// Create the status line
|
||||||
static const int dims[5] = { -1, 100, 100, 100, 140 };
|
static const int dims[5] = { -1, 100, 100, 100, 140 };
|
||||||
|
@ -82,12 +100,12 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
|
|
||||||
// ReCreateAuxiliaryToolbar();
|
// ReCreateAuxiliaryToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
|
|
||||||
// Make a EDA_3D_CANVAS
|
// 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 EDA_3D_CANVAS( this, attrs );
|
m_canvas = new EDA_3D_CANVAS( this, attrs );
|
||||||
|
|
||||||
m_auimgr.SetManagedWindow( this );
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
|
@ -98,7 +116,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long
|
||||||
m_auimgr.AddPane( m_HToolBar,
|
m_auimgr.AddPane( m_HToolBar,
|
||||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
|
||||||
|
|
||||||
m_auimgr.AddPane( m_Canvas,
|
m_auimgr.AddPane( m_canvas,
|
||||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
@ -106,7 +124,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long
|
||||||
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
|
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
|
||||||
// in order to receive mouse events. Otherwise, the user has to click somewhere on
|
// in order to receive mouse events. Otherwise, the user has to click somewhere on
|
||||||
// the canvas before it will respond to mouse wheel events.
|
// the canvas before it will respond to mouse wheel events.
|
||||||
m_Canvas->SetFocus();
|
m_canvas->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,74 +139,88 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
if( Parent() )
|
if( Parent() )
|
||||||
{
|
|
||||||
Parent()->m_Draw3DFrame = NULL;
|
Parent()->m_Draw3DFrame = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const wxString keyPosx( wxT( "Pos_x" ) );
|
|
||||||
static const wxString keyPosy( wxT( "Pos_y" ) );
|
|
||||||
static const wxString keySizex( wxT( "Size_x" ) );
|
|
||||||
static const wxString keySizey( wxT( "Size_y" ) );
|
|
||||||
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
|
|
||||||
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
|
|
||||||
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::GetSettings()
|
void EDA_3D_FRAME::GetSettings()
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||||
|
|
||||||
if( config )
|
if( config )
|
||||||
{
|
{
|
||||||
text = m_FrameName + keyPosx;
|
text = m_frameName + keyPosx;
|
||||||
config->Read( text, &m_FramePos.x );
|
config->Read( text, &m_framePos.x );
|
||||||
text = m_FrameName + keyPosy;
|
text = m_frameName + keyPosy;
|
||||||
config->Read( text, &m_FramePos.y );
|
config->Read( text, &m_framePos.y );
|
||||||
text = m_FrameName + keySizex;
|
text = m_frameName + keySizex;
|
||||||
config->Read( text, &m_FrameSize.x, 600 );
|
config->Read( text, &m_frameSize.x, 600 );
|
||||||
text = m_FrameName + keySizey;
|
text = m_frameName + keySizey;
|
||||||
config->Read( text, &m_FrameSize.y, 400 );
|
config->Read( text, &m_frameSize.y, 400 );
|
||||||
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
||||||
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
||||||
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||||
|
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||||
|
config->Read( keyShowAxis, &prms.m_DrawFlags[prms.FL_AXIS], true );
|
||||||
|
config->Read( keyShowFootprints, &prms.m_DrawFlags[prms.FL_MODULE], true );
|
||||||
|
config->Read( keyShowCopperThickness,
|
||||||
|
&prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS],
|
||||||
|
false );
|
||||||
|
config->Read( keyShowZones, &prms.m_DrawFlags[prms.FL_ZONE], true );
|
||||||
|
config->Read( keyShowCommetsLayer, &prms.m_DrawFlags[prms.FL_COMMENTS], true );
|
||||||
|
config->Read( keyShowDrawingsLayer, &prms.m_DrawFlags[prms.FL_DRAWINGS], true );
|
||||||
|
config->Read( keyShowEco1Layer, &prms.m_DrawFlags[prms.FL_ECO1], true );
|
||||||
|
config->Read( keyShowEco2Layer, &prms.m_DrawFlags[prms.FL_ECO2], true );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
|
|
||||||
// for macOSX, the window must be below system (macOSX) toolbar
|
// for macOSX, the window must be below system (macOSX) toolbar
|
||||||
if( m_FramePos.y < 20 )
|
if( m_FramePos.y < 20 )
|
||||||
m_FramePos.y = 20;
|
m_FramePos.y = 20;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::SaveSettings()
|
void EDA_3D_FRAME::SaveSettings()
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* Config = wxGetApp().GetSettings(); // Current config used by application
|
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||||
|
|
||||||
if( !Config )
|
if( !config )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||||
Config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||||
Config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||||
|
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||||
|
config->Write( keyShowAxis, prms.m_DrawFlags[prms.FL_AXIS] );
|
||||||
|
config->Write( keyShowFootprints, prms.m_DrawFlags[prms.FL_MODULE] );
|
||||||
|
config->Write( keyShowCopperThickness, prms.m_DrawFlags[prms.FL_USE_COPPER_THICKNESS] );
|
||||||
|
config->Write( keyShowZones, prms.m_DrawFlags[prms.FL_ZONE] );
|
||||||
|
config->Write( keyShowCommetsLayer, prms.m_DrawFlags[prms.FL_COMMENTS] );
|
||||||
|
config->Write( keyShowDrawingsLayer, prms.m_DrawFlags[prms.FL_DRAWINGS] );
|
||||||
|
config->Write( keyShowEco1Layer, prms.m_DrawFlags[prms.FL_ECO1] );
|
||||||
|
config->Write( keyShowEco2Layer, prms.m_DrawFlags[prms.FL_ECO2] );
|
||||||
|
|
||||||
if( IsIconized() )
|
if( IsIconized() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_FrameSize = GetSize();
|
m_frameSize = GetSize();
|
||||||
m_FramePos = GetPosition();
|
m_framePos = GetPosition();
|
||||||
|
|
||||||
text = m_FrameName + keyPosx;
|
text = m_frameName + keyPosx;
|
||||||
Config->Write( text, (long) m_FramePos.x );
|
config->Write( text, (long) m_framePos.x );
|
||||||
text = m_FrameName + keyPosy;
|
text = m_frameName + keyPosy;
|
||||||
Config->Write( text, (long) m_FramePos.y );
|
config->Write( text, (long) m_framePos.y );
|
||||||
text = m_FrameName + keySizex;
|
text = m_frameName + keySizex;
|
||||||
Config->Write( text, (long) m_FrameSize.x );
|
config->Write( text, (long) m_frameSize.x );
|
||||||
text = m_FrameName + keySizey;
|
text = m_frameName + keySizey;
|
||||||
Config->Write( text, (long) m_FrameSize.y );
|
config->Write( text, (long) m_frameSize.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,18 +231,21 @@ void EDA_3D_FRAME::Process_Zoom( wxCommandEvent& event )
|
||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
case ID_ZOOM_PAGE:
|
case ID_ZOOM_PAGE:
|
||||||
|
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||||
|
|
||||||
g_Parm_3D_Visu.m_Zoom = 1.0;
|
g_Parm_3D_Visu.m_Zoom = 1.0;
|
||||||
m_Canvas->SetOffset(0.0, 0.0);
|
m_canvas->SetOffset( 0.0, 0.0 );
|
||||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ZOOM_IN:
|
case ID_ZOOM_IN:
|
||||||
g_Parm_3D_Visu.m_Zoom /= 1.2;
|
g_Parm_3D_Visu.m_Zoom /= 1.2;
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
|
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
|
||||||
g_Parm_3D_Visu.m_Zoom = 0.01;
|
g_Parm_3D_Visu.m_Zoom = 0.01;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ZOOM_OUT:
|
case ID_ZOOM_OUT:
|
||||||
|
@ -224,8 +259,8 @@ void EDA_3D_FRAME::Process_Zoom( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Canvas->Refresh( false );
|
m_canvas->Refresh( false );
|
||||||
m_Canvas->DisplayStatus();
|
m_canvas->DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,8 +288,8 @@ void EDA_3D_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
#define ROT_ANGLE 10.0
|
#define ROT_ANGLE 10.0
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
bool isChecked = event.IsChecked();
|
bool isChecked = event.IsChecked();
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
@ -288,29 +323,29 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MOVE3D_LEFT:
|
case ID_MOVE3D_LEFT:
|
||||||
m_Canvas->SetView3D( WXK_LEFT );
|
m_canvas->SetView3D( WXK_LEFT );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MOVE3D_RIGHT:
|
case ID_MOVE3D_RIGHT:
|
||||||
m_Canvas->SetView3D( WXK_RIGHT );
|
m_canvas->SetView3D( WXK_RIGHT );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MOVE3D_UP:
|
case ID_MOVE3D_UP:
|
||||||
m_Canvas->SetView3D( WXK_UP );
|
m_canvas->SetView3D( WXK_UP );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MOVE3D_DOWN:
|
case ID_MOVE3D_DOWN:
|
||||||
m_Canvas->SetView3D( WXK_DOWN );
|
m_canvas->SetView3D( WXK_DOWN );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_ORTHO:
|
case ID_ORTHO:
|
||||||
m_Canvas->ToggleOrtho();
|
ToggleOrtho();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
|
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
|
||||||
case ID_MENU_SCREENCOPY_PNG:
|
case ID_MENU_SCREENCOPY_PNG:
|
||||||
case ID_MENU_SCREENCOPY_JPEG:
|
case ID_MENU_SCREENCOPY_JPEG:
|
||||||
m_Canvas->TakeScreenshot( event );
|
m_canvas->TakeScreenshot( event );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MENU3D_BGCOLOR_SELECTION:
|
case ID_MENU3D_BGCOLOR_SELECTION:
|
||||||
|
@ -362,10 +397,11 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
m_Canvas->DisplayStatus();
|
m_canvas->DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
@ -374,6 +410,7 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( event.GetId() == ii )
|
if( event.GetId() == ii )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GetMenuBar()->Check( ii, false );
|
GetMenuBar()->Check( ii, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,12 +454,12 @@ void EDA_3D_FRAME::NewDisplay()
|
||||||
{
|
{
|
||||||
m_reloadRequest = false;
|
m_reloadRequest = false;
|
||||||
|
|
||||||
m_Canvas->ClearLists();
|
m_canvas->ClearLists();
|
||||||
m_Canvas->CreateDrawGL_List();
|
m_canvas->CreateDrawGL_List();
|
||||||
|
|
||||||
// m_Canvas->InitGL();
|
// m_canvas->InitGL();
|
||||||
m_Canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
m_Canvas->DisplayStatus();
|
m_canvas->DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -433,7 +470,7 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
if( m_reloadRequest )
|
if( m_reloadRequest )
|
||||||
NewDisplay();
|
NewDisplay();
|
||||||
|
|
||||||
event.Skip(); // required under wxMAC
|
event.Skip(); // required under wxMAC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,8 +478,8 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
*/
|
*/
|
||||||
void EDA_3D_FRAME::Set3DBgColor()
|
void EDA_3D_FRAME::Set3DBgColor()
|
||||||
{
|
{
|
||||||
S3D_COLOR color;
|
S3D_COLOR color;
|
||||||
wxColour newcolor, oldcolor;
|
wxColour newcolor, oldcolor;
|
||||||
|
|
||||||
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
||||||
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
||||||
|
@ -452,9 +489,9 @@ void EDA_3D_FRAME::Set3DBgColor()
|
||||||
|
|
||||||
if( newcolor != oldcolor )
|
if( newcolor != oldcolor )
|
||||||
{
|
{
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0;
|
g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0;
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0;
|
g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0;
|
||||||
NewDisplay();
|
NewDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <wxBasePcbFrame.h> // for m_auimanager member.
|
#include <wxBasePcbFrame.h> // for m_auimanager member.
|
||||||
#include <layers_id_colors_and_visibility.h> // Layers id definitions
|
#include <layers_id_colors_and_visibility.h> // Layers id definitions
|
||||||
#include <PolyLine.h> // fot CPolyPt
|
#include <PolyLine.h> // fot CPolyPt
|
||||||
|
|
||||||
#if !wxUSE_GLCANVAS
|
#if !wxUSE_GLCANVAS
|
||||||
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
||||||
|
@ -52,142 +52,25 @@
|
||||||
|
|
||||||
#include <3d_struct.h>
|
#include <3d_struct.h>
|
||||||
|
|
||||||
|
class EDA_3D_CANVAS;
|
||||||
class BOARD_DESIGN_SETTINGS;
|
|
||||||
class TRACK;
|
|
||||||
class TEXTE_PCB;
|
|
||||||
class DRAWSEGMENT;
|
|
||||||
class ZONE_CONTAINER;
|
|
||||||
|
|
||||||
|
|
||||||
#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" )
|
||||||
|
|
||||||
class EDA_3D_FRAME;
|
|
||||||
class S3D_VERTEX;
|
|
||||||
class SEGVIA;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EDA_3D_CANVAS : public wxGLCanvas
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
bool m_init;
|
|
||||||
GLuint m_gllist;
|
|
||||||
/// Tracks whether to use Orthographic or Perspective projection
|
|
||||||
// TODO: Does this belong here, or in EDA_3D_FRAME ???
|
|
||||||
bool m_ortho;
|
|
||||||
wxGLContext* m_glRC;
|
|
||||||
wxRealPoint m_draw3dOffset; // offset to draw the 3 mesh.
|
|
||||||
double m_ZBottom; // position of the back layer
|
|
||||||
double m_ZTop; // position of the front layer
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList = 0 );
|
|
||||||
~EDA_3D_CANVAS();
|
|
||||||
|
|
||||||
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
|
|
||||||
|
|
||||||
void ClearLists();
|
|
||||||
|
|
||||||
// Event functions:
|
|
||||||
void OnPaint( wxPaintEvent& event );
|
|
||||||
void OnEraseBackground( wxEraseEvent& event );
|
|
||||||
void OnChar( wxKeyEvent& event );
|
|
||||||
void OnMouseWheel( wxMouseEvent& event );
|
|
||||||
void OnMouseMove( wxMouseEvent& event );
|
|
||||||
void OnRightClick( wxMouseEvent& event );
|
|
||||||
void OnPopUpMenu( wxCommandEvent& event );
|
|
||||||
void TakeScreenshot( wxCommandEvent& event );
|
|
||||||
void OnEnterWindow( wxMouseEvent& event );
|
|
||||||
|
|
||||||
// Display functions
|
|
||||||
GLuint DisplayCubeforTest(); // Just a test function
|
|
||||||
void SetView3D( int keycode );
|
|
||||||
void DisplayStatus();
|
|
||||||
void Redraw( bool finish = false );
|
|
||||||
void Render();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CreateDrawGL_List
|
|
||||||
* creates the OpenGL draw list items.
|
|
||||||
*/
|
|
||||||
GLuint CreateDrawGL_List();
|
|
||||||
void InitGL();
|
|
||||||
void SetLights();
|
|
||||||
void SetOffset(double aPosX, double aPosY)
|
|
||||||
{
|
|
||||||
m_draw3dOffset.x = aPosX;
|
|
||||||
m_draw3dOffset.y = aPosY;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawGrid( double aGriSizeMM );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function Draw3D_Track
|
|
||||||
* @param aTrack = the aTrack to draw
|
|
||||||
*/
|
|
||||||
void Draw3D_Track( TRACK* aTrack );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function Draw3D_Via
|
|
||||||
* draws 3D via as a cylinder and filled circles.
|
|
||||||
*/
|
|
||||||
void Draw3D_Via( SEGVIA* via );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function Draw3D_DrawSegment
|
|
||||||
* draws a 3D segment (line, arc or circle).
|
|
||||||
*/
|
|
||||||
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function Draw3D_Zone
|
|
||||||
* draw all solid areas in aZone
|
|
||||||
* @param aZone = the zone to draw
|
|
||||||
*/
|
|
||||||
void Draw3D_Zone( ZONE_CONTAINER* aZone );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function Draw3D_DrawText
|
|
||||||
* draws 3D segments to create text objects.
|
|
||||||
* When DrawGraphicText is called to draw a text to an OpenGL DC
|
|
||||||
* it calls Draw3dTextSegm to each segment to draw.
|
|
||||||
* 2 parameters used by Draw3D_FilledSegment are not handled by DrawGraphicText
|
|
||||||
* but are used in Draw3D_FilledSegment().
|
|
||||||
* they are 2 local variables. This is an ugly, but trivial code.
|
|
||||||
* Using DrawGraphicText to draw all texts ensure texts have the same shape
|
|
||||||
* in all contexts
|
|
||||||
*/
|
|
||||||
void Draw3D_DrawText( TEXTE_PCB* text );
|
|
||||||
|
|
||||||
/// Toggles orthographic projection on and off
|
|
||||||
void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);};
|
|
||||||
|
|
||||||
/// Returns the orthographic projection flag
|
|
||||||
bool ModeIsOrtho() { return m_ortho ;};
|
|
||||||
|
|
||||||
|
|
||||||
//int Get3DLayerEnable(int act_layer);
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class EDA_3D_FRAME : public wxFrame
|
class EDA_3D_FRAME : public wxFrame
|
||||||
{
|
{
|
||||||
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"
|
||||||
EDA_3D_CANVAS* m_Canvas;
|
EDA_3D_CANVAS* m_canvas;
|
||||||
wxAuiToolBar* m_HToolBar;
|
wxAuiToolBar* m_HToolBar;
|
||||||
wxAuiToolBar* m_VToolBar;
|
wxAuiToolBar* m_VToolBar;
|
||||||
wxPoint m_FramePos;
|
wxPoint m_framePos;
|
||||||
wxSize m_FrameSize;
|
wxSize m_frameSize;
|
||||||
wxAuiManager m_auimgr;
|
wxAuiManager m_auimgr;
|
||||||
bool m_reloadRequest;
|
bool m_reloadRequest;
|
||||||
wxString m_defaultFileName; /// Filename to propose for screenshot
|
wxString m_defaultFileName; /// Filename to propose for screenshot
|
||||||
|
/// Tracks whether to use Orthographic or Perspective projection
|
||||||
|
bool m_ortho;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title,
|
EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title,
|
||||||
|
@ -219,9 +102,23 @@ public:
|
||||||
|
|
||||||
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
|
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
|
||||||
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
||||||
|
|
||||||
|
/// Toggles orthographic projection on and off
|
||||||
|
void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);};
|
||||||
|
|
||||||
|
/// Returns the orthographic projection flag
|
||||||
|
bool ModeIsOrtho() { return m_ortho ;};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Event handlers:
|
||||||
void Exit3DFrame( wxCommandEvent& event );
|
void Exit3DFrame( wxCommandEvent& event );
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
|
void On3DGridSelection( wxCommandEvent& event );
|
||||||
|
void Process_Zoom( wxCommandEvent& event );
|
||||||
|
void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
|
// initialisation
|
||||||
void ReCreateMenuBar();
|
void ReCreateMenuBar();
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
void ReCreateVToolbar();
|
void ReCreateVToolbar();
|
||||||
|
@ -229,15 +126,12 @@ private:
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
|
// Other functions
|
||||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
||||||
void OnKeyEvent( wxKeyEvent& event );
|
void OnKeyEvent( wxKeyEvent& event );
|
||||||
double BestZoom();
|
double BestZoom();
|
||||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
|
||||||
void On3DGridSelection( wxCommandEvent& event );
|
|
||||||
void Process_Zoom( wxCommandEvent& event );
|
|
||||||
void OnActivate( wxActivateEvent& event );
|
|
||||||
|
|
||||||
void Set3DBgColor();
|
void Set3DBgColor();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue