3d-frame: is now derived from EDA_BASE_FRAME. Remove duplicate code and some useless includes
This commit is contained in:
parent
f43ed90921
commit
fa8cbd983b
|
@ -31,7 +31,6 @@
|
|||
#define _3D_CANVAS_H_
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wxBasePcbFrame.h> // for m_auimanager member.
|
||||
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
|
@ -49,6 +48,7 @@ class BOARD_DESIGN_SETTINGS;
|
|||
class EDA_3D_FRAME;
|
||||
class S3D_VERTEX;
|
||||
class SEGVIA;
|
||||
class D_PAD;
|
||||
|
||||
|
||||
class EDA_3D_CANVAS : public wxGLCanvas
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <drawtxt.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
|
@ -248,6 +249,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
&& layer >= g_Parm_3D_Visu.m_CopperLayersCount )
|
||||
continue;
|
||||
|
||||
// Skip non enabled layers in normal mode,
|
||||
// and internal layers in realistic mode
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
|
@ -293,7 +296,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// Micro-wave modukes may have items on copper layers
|
||||
// Micro-wave modules may have items on copper layers
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys,
|
||||
0,
|
||||
|
|
|
@ -34,16 +34,12 @@
|
|||
#include <trackball.h>
|
||||
|
||||
#include <wx/colordlg.h>
|
||||
#include <wxstruct.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <wxBasePcbFrame.h>
|
||||
|
||||
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" ) );
|
||||
|
@ -60,7 +56,7 @@ static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
|
|||
static const wxString keyShowBoardBody( wxT( "ShowBoardBody" ) );
|
||||
static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) );
|
||||
|
||||
BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame )
|
||||
BEGIN_EVENT_TABLE( EDA_3D_FRAME, EDA_BASE_FRAME )
|
||||
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
||||
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, EDA_3D_FRAME::Process_Zoom )
|
||||
|
@ -79,12 +75,10 @@ EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
|||
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
||||
const wxString& title,
|
||||
long style ) :
|
||||
wxFrame( parent, DISPLAY3D_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style )
|
||||
EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
{
|
||||
m_frameName = wxT( "Frame3D" );
|
||||
m_canvas = NULL;
|
||||
m_HToolBar = NULL;
|
||||
m_VToolBar = NULL;
|
||||
m_reloadRequest = false;
|
||||
m_ortho = false;
|
||||
|
||||
|
@ -94,7 +88,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
|||
SetIcon( icon );
|
||||
|
||||
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
|
||||
static const int dims[5] = { -1, 100, 100, 100, 140 };
|
||||
|
@ -103,10 +97,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
|||
SetStatusWidths( 5, dims );
|
||||
|
||||
CreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
||||
// ReCreateAuxiliaryToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
// Make a EDA_3D_CANVAS
|
||||
int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 };
|
||||
|
@ -115,11 +106,11 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
|||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
|
||||
EDA_PANEINFO horiz;
|
||||
horiz.HorizontalToolbarPane();
|
||||
EDA_PANEINFO horiztb;
|
||||
horiztb.HorizontalToolbarPane();
|
||||
|
||||
m_auimgr.AddPane( m_HToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );
|
||||
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
|
@ -141,9 +132,6 @@ void EDA_3D_FRAME::Exit3DFrame( wxCommandEvent& event )
|
|||
|
||||
void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
SaveSettings();
|
||||
Show( false );
|
||||
|
||||
if( Parent() )
|
||||
Parent()->m_Draw3DFrame = NULL;
|
||||
|
||||
|
@ -153,20 +141,13 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
void EDA_3D_FRAME::GetSettings()
|
||||
{
|
||||
wxString text;
|
||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
|
||||
if( config )
|
||||
{
|
||||
text = m_frameName + keyPosx;
|
||||
config->Read( text, &m_framePos.x );
|
||||
text = m_frameName + keyPosy;
|
||||
config->Read( text, &m_framePos.y );
|
||||
text = m_frameName + keySizex;
|
||||
config->Read( text, &m_frameSize.x, 600 );
|
||||
text = m_frameName + keySizey;
|
||||
config->Read( text, &m_frameSize.y, 400 );
|
||||
EDA_BASE_FRAME::LoadSettings();
|
||||
|
||||
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_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||
|
@ -213,12 +194,13 @@ void EDA_3D_FRAME::GetSettings()
|
|||
|
||||
void EDA_3D_FRAME::SaveSettings()
|
||||
{
|
||||
wxString text;
|
||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||
|
||||
if( !config )
|
||||
return;
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings();
|
||||
|
||||
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_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||
|
@ -235,21 +217,6 @@ void EDA_3D_FRAME::SaveSettings()
|
|||
config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
|
||||
if( IsIconized() )
|
||||
return;
|
||||
|
||||
m_frameSize = GetSize();
|
||||
m_framePos = GetPosition();
|
||||
|
||||
text = m_frameName + keyPosx;
|
||||
config->Write( text, (long) m_framePos.x );
|
||||
text = m_frameName + keyPosy;
|
||||
config->Write( text, (long) m_framePos.y );
|
||||
text = m_frameName + keySizex;
|
||||
config->Write( text, (long) m_frameSize.x );
|
||||
text = m_frameName + keySizey;
|
||||
config->Write( text, (long) m_frameSize.y );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,104 +35,98 @@
|
|||
#include <3d_viewer_id.h>
|
||||
|
||||
|
||||
void EDA_3D_FRAME::ReCreateHToolbar()
|
||||
void EDA_3D_FRAME::ReCreateMainToolbar()
|
||||
{
|
||||
if( m_HToolBar != NULL )
|
||||
if( m_mainToolBar != NULL )
|
||||
{
|
||||
// Simple update to the list of old files.
|
||||
SetToolbars();
|
||||
return;
|
||||
}
|
||||
|
||||
m_HToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
||||
|
||||
// Set up toolbar
|
||||
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmap( import3d_xpm ),
|
||||
_( "Reload board" ) );
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmap( import3d_xpm ), _( "Reload board" ) );
|
||||
|
||||
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
||||
|
||||
// Does not work properly under linux
|
||||
m_HToolBar->AddSeparator();
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiBitmap( copy_button_xpm ),
|
||||
_( "Copy 3D Image to Clipboard" ) );
|
||||
#endif
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_HToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
|
||||
KiBitmap( read_setup_xpm ),
|
||||
_( "Set display options, and some layers visibility" ) );
|
||||
m_HToolBar->AddSeparator();
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
||||
_( "Zoom in" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
||||
_( "Zoom out" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
KiBitmap( zoom_redraw_xpm ),
|
||||
_( "Redraw view" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
||||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
||||
_( "Fit in page" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
|
||||
KiBitmap( rotate_neg_x_xpm ),
|
||||
_( "Rotate X <-" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
|
||||
KiBitmap( rotate_pos_x_xpm ),
|
||||
_( "Rotate X ->" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
|
||||
KiBitmap( rotate_neg_y_xpm ),
|
||||
_( "Rotate Y <-" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
|
||||
KiBitmap( rotate_pos_y_xpm ),
|
||||
_( "Rotate Y ->" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
|
||||
KiBitmap( rotate_neg_z_xpm ),
|
||||
_( "Rotate Z <-" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
|
||||
KiBitmap( rotate_pos_z_xpm ),
|
||||
_( "Rotate Z ->" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
|
||||
_( "Move left" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
|
||||
_( "Move right" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
|
||||
_( "Move up" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
|
||||
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
|
||||
_( "Move down" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
|
||||
_( "Enable/Disable orthographic projection" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_HToolBar->Realize();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::ReCreateVToolbar()
|
||||
{
|
||||
m_mainToolBar->Realize();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
@ -30,10 +30,10 @@
|
|||
#ifndef __3D_VIEWER_H__
|
||||
#define __3D_VIEWER_H__
|
||||
|
||||
#include <wxBasePcbFrame.h> // for m_auimanager member.
|
||||
#include <wxstruct.h> // for EDA_BASE_FRAME.
|
||||
|
||||
#if !wxUSE_GLCANVAS
|
||||
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
||||
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
|
||||
#endif
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
@ -51,20 +51,15 @@
|
|||
#include <3d_struct.h>
|
||||
|
||||
class EDA_3D_CANVAS;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
||||
#define LIB3D_PATH wxT( "packages3d" )
|
||||
|
||||
class EDA_3D_FRAME : public wxFrame
|
||||
class EDA_3D_FRAME : public EDA_BASE_FRAME
|
||||
{
|
||||
private:
|
||||
wxString m_frameName; // name used for writing and reading setup. It is "Frame3D"
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
wxAuiToolBar* m_HToolBar;
|
||||
wxAuiToolBar* m_VToolBar;
|
||||
wxPoint m_framePos;
|
||||
wxSize m_frameSize;
|
||||
wxAuiManager m_auimgr;
|
||||
bool m_reloadRequest;
|
||||
wxString m_defaultFileName; /// Filename to propose for screenshot
|
||||
/// Tracks whether to use Orthographic or Perspective projection
|
||||
|
@ -121,8 +116,7 @@ private:
|
|||
void CreateMenuBar();
|
||||
void SetMenuBarOptionsState(); // Set the state of toggle menus according
|
||||
// to the current display options
|
||||
void ReCreateHToolbar();
|
||||
void ReCreateVToolbar();
|
||||
void ReCreateMainToolbar();
|
||||
void SetToolbars();
|
||||
void GetSettings();
|
||||
void SaveSettings();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#ifndef __INFO3D_VISU_H__
|
||||
#define __INFO3D_VISU_H__
|
||||
|
||||
#include <wxBasePcbFrame.h> // m_auimanager member.
|
||||
//#include <wxBasePcbFrame.h>
|
||||
#include <layers_id_colors_and_visibility.h> // Layers id definitions
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
@ -51,6 +51,7 @@
|
|||
#define m_ROTY m_Rot[1]
|
||||
#define m_ROTZ m_Rot[2]
|
||||
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
|
||||
class S3D_COLOR /* 3D color (R, G, B) 3 floats range 0 to 1.0*/
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue