Rewrite code for PANEL_PREV_3D because the way events were previously managed are not compatible with a good mouse event management.
To avoid a lot of tedious code, wxFormbuilder is used to create the PANEL_PREV_3D_BASE class.
This commit is contained in:
parent
6561c8e61a
commit
43cb4560bf
|
@ -0,0 +1,259 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 4 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_prev_3d_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxBoxSizer* bSizermain;
|
||||
bSizermain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerLeft;
|
||||
bSizerLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* vbScale;
|
||||
vbScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerScale;
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizerScale->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText1 = new wxStaticText( vbScale->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( xscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText2 = new wxStaticText( vbScale->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( yscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText3 = new wxStaticText( vbScale->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
fgSizerScale->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerScale->Add( zscale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
vbScale->Add( fgSizerScale, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( vbScale, 0, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* vbRotate;
|
||||
vbRotate = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation (degrees)") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerRotate;
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizerRotate->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText11 = new wxStaticText( vbRotate->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xrot = new wxTextCtrl( vbRotate->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !xrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
xrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
xrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( xrot, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText21 = new wxStaticText( vbRotate->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText21->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yrot = new wxTextCtrl( vbRotate->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !yrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
yrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
yrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( yrot, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText31 = new wxStaticText( vbRotate->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
fgSizerRotate->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zrot = new wxTextCtrl( vbRotate->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !zrot->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
zrot->SetMaxLength( 9 );
|
||||
}
|
||||
#else
|
||||
zrot->SetMaxLength( 9 );
|
||||
#endif
|
||||
fgSizerRotate->Add( zrot, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
vbRotate->Add( fgSizerRotate, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( vbRotate, 0, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* vbOffset;
|
||||
vbOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerOffset;
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizerOffset->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText12 = new wxStaticText( vbOffset->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText12->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
xoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( xoff, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText22 = new wxStaticText( vbOffset->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText22->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
yoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( yoff, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( vbOffset->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( -1 );
|
||||
fgSizerOffset->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
zoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerOffset->Add( zoff, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
vbOffset->Add( fgSizerOffset, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( vbOffset, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerLeft, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRight;
|
||||
bSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_SizerPanelView = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer3DButtons;
|
||||
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_fgSizerButtons = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
m_fgSizerButtons->AddGrowableCol( 0 );
|
||||
m_fgSizerButtons->AddGrowableCol( 1 );
|
||||
m_fgSizerButtons->AddGrowableCol( 2 );
|
||||
m_fgSizerButtons->AddGrowableCol( 3 );
|
||||
m_fgSizerButtons->SetFlexibleDirection( wxBOTH );
|
||||
m_fgSizerButtons->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_bpvISO->SetToolTip( _("Change to isometric perspective") );
|
||||
|
||||
m_fgSizerButtons->Add( m_bpvISO, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvLeft, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvFront, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvTop, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_bpUpdate->SetToolTip( _("Reload board and 3D models") );
|
||||
|
||||
m_fgSizerButtons->Add( m_bpUpdate, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvRight, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvBack, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
|
||||
m_fgSizerButtons->Add( m_bpvBottom, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( m_fgSizerButtons, 6, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizer3DButtons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerRight, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizermain );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
xscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
xrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
xoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvBack->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_PREV_3D_BASE::~PANEL_PREV_3D_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
xscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
xrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
xoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
yoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
zoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
|
||||
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this );
|
||||
m_bpvTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
|
||||
m_bpUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DRight ), NULL, this );
|
||||
m_bpvBack->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBack ), NULL, this );
|
||||
m_bpvBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,89 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 4 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEL_PREV_3D_BASE_H__
|
||||
#define __PANEL_PREV_3D_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_PREV_3D_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_PREV_3D_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* xscale;
|
||||
wxStaticText* m_staticText2;
|
||||
wxTextCtrl* yscale;
|
||||
wxStaticText* m_staticText3;
|
||||
wxTextCtrl* zscale;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* xrot;
|
||||
wxStaticText* m_staticText21;
|
||||
wxTextCtrl* yrot;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* zrot;
|
||||
wxStaticText* m_staticText12;
|
||||
wxTextCtrl* xoff;
|
||||
wxStaticText* m_staticText22;
|
||||
wxTextCtrl* yoff;
|
||||
wxStaticText* m_staticText32;
|
||||
wxTextCtrl* zoff;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
wxFlexGridSizer* m_fgSizerButtons;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
wxBitmapButton* m_bpvLeft;
|
||||
wxBitmapButton* m_bpvFront;
|
||||
wxBitmapButton* m_bpvTop;
|
||||
wxBitmapButton* m_bpUpdate;
|
||||
wxBitmapButton* m_bpvRight;
|
||||
wxBitmapButton* m_bpvBack;
|
||||
wxBitmapButton* m_bpvBottom;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void updateOrientation( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DTop( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DUpdate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBack( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBottom( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 504,285 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_PREV_3D_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__PANEL_PREV_3D_BASE_H__
|
|
@ -3,7 +3,8 @@
|
|||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2015-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015-2017 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
|
||||
|
@ -39,6 +40,69 @@
|
|||
#include <class_board.h>
|
||||
|
||||
|
||||
PANEL_PREV_3D_B::PANEL_PREV_3D_B( wxWindow* aParent, S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
std::vector<S3D_INFO> *aParentInfoList ):
|
||||
PANEL_PREV_3D_BASE( aParent, wxID_ANY )
|
||||
{
|
||||
initPanel();
|
||||
|
||||
if( NULL != aCacheManager )
|
||||
m_resolver = aCacheManager->GetResolver();
|
||||
|
||||
m_parentInfoList = aParentInfoList;
|
||||
|
||||
m_dummyBoard->Add( (MODULE*)aModuleCopy );
|
||||
m_copyModule = aModuleCopy;
|
||||
|
||||
// Set 3d viewer configuration for preview
|
||||
m_settings3Dviewer = new CINFO3D_VISU();
|
||||
|
||||
// Create the 3D canvas
|
||||
m_previewPane = new EDA_3D_CANVAS( this,
|
||||
COGL_ATT_LIST::GetAttributesList( true ),
|
||||
m_dummyBoard,
|
||||
*m_settings3Dviewer,
|
||||
aCacheManager );
|
||||
|
||||
m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND );
|
||||
|
||||
m_previewPane->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler(
|
||||
PANEL_PREV_3D_B::onEnterPreviewCanvas ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
PANEL_PREV_3D_B::~PANEL_PREV_3D_B()
|
||||
{
|
||||
m_previewPane->Disconnect( wxEVT_ENTER_WINDOW,
|
||||
wxMouseEventHandler( PANEL_PREV_3D_B::onEnterPreviewCanvas ), NULL, this );
|
||||
|
||||
delete m_settings3Dviewer;
|
||||
delete m_dummyBoard;
|
||||
delete m_previewPane;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D_B::initPanel()
|
||||
{
|
||||
m_resolver = NULL;
|
||||
currentModelFile.clear();
|
||||
m_dummyBoard = new BOARD();
|
||||
m_currentSelectedIdx = -1;
|
||||
|
||||
m_bpvTop->SetBitmap( KiBitmap( axis3d_top_xpm ) );
|
||||
m_bpvFront->SetBitmap( KiBitmap( axis3d_front_xpm ) );
|
||||
m_bpvBack->SetBitmap( KiBitmap( axis3d_back_xpm ) );
|
||||
m_bpvLeft->SetBitmap( KiBitmap( axis3d_left_xpm ) );
|
||||
m_bpvRight->SetBitmap( KiBitmap( axis3d_right_xpm ) );
|
||||
m_bpvBottom->SetBitmap( KiBitmap( axis3d_bottom_xpm ) );
|
||||
m_bpvISO->SetBitmap( KiBitmap( ortho_xpm ) );
|
||||
m_bpUpdate->SetBitmap( KiBitmap( reload_xpm ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief checkRotation - ensure -360 < rotation < 360
|
||||
* @param rot: in out parameter
|
||||
|
@ -60,283 +124,6 @@ static void checkRotation( double& rot )
|
|||
}
|
||||
|
||||
|
||||
enum {
|
||||
ID_SCALEX = ID_KICAD_PANEL_PREV_MODEL_START,
|
||||
ID_SCALEY,
|
||||
ID_SCALEZ,
|
||||
ID_ROTX,
|
||||
ID_ROTY,
|
||||
ID_ROTZ,
|
||||
ID_OFFX,
|
||||
ID_OFFY,
|
||||
ID_OFFZ,
|
||||
ID_3D_ISO,
|
||||
ID_3D_UPDATE,
|
||||
ID_3D_LEFT,
|
||||
ID_3D_RIGHT,
|
||||
ID_3D_FRONT,
|
||||
ID_3D_BACK,
|
||||
ID_3D_TOP,
|
||||
ID_3D_BOTTOM,
|
||||
ID_3D_END = ID_KICAD_PANEL_PREV_MODEL_END
|
||||
};
|
||||
|
||||
|
||||
wxBEGIN_EVENT_TABLE( PANEL_PREV_3D, wxPanel)
|
||||
EVT_TEXT( ID_SCALEX, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_SCALEY, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_SCALEZ, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_ROTX, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_ROTY, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_ROTZ, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_OFFX, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_OFFY, PANEL_PREV_3D::updateOrientation )
|
||||
EVT_TEXT( ID_OFFZ, PANEL_PREV_3D::updateOrientation )
|
||||
|
||||
EVT_TOGGLEBUTTON( ID_3D_ISO, PANEL_PREV_3D::View3DISO )
|
||||
EVT_BUTTON( ID_3D_UPDATE, PANEL_PREV_3D::View3DUpdate )
|
||||
EVT_BUTTON( ID_3D_LEFT, PANEL_PREV_3D::View3DLeft )
|
||||
EVT_BUTTON( ID_3D_RIGHT, PANEL_PREV_3D::View3DRight )
|
||||
EVT_BUTTON( ID_3D_FRONT, PANEL_PREV_3D::View3DFront )
|
||||
EVT_BUTTON( ID_3D_BACK, PANEL_PREV_3D::View3DBack )
|
||||
EVT_BUTTON( ID_3D_TOP, PANEL_PREV_3D::View3DTop )
|
||||
EVT_BUTTON( ID_3D_BOTTOM, PANEL_PREV_3D::View3DBottom )
|
||||
EVT_CLOSE( PANEL_PREV_3D::OnCloseWindow )
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent,
|
||||
S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
std::vector<S3D_INFO> *aParentInfoList ) :
|
||||
wxPanel( aParent, -1 )
|
||||
{
|
||||
if( NULL != aCacheManager )
|
||||
m_resolver = aCacheManager->GetResolver();
|
||||
else
|
||||
m_resolver = NULL;
|
||||
|
||||
m_currentSelectedIdx = -1;
|
||||
m_parentInfoList = aParentInfoList;
|
||||
m_previewPane = NULL;
|
||||
xscale = NULL;
|
||||
yscale = NULL;
|
||||
zscale = NULL;
|
||||
xrot = NULL;
|
||||
yrot = NULL;
|
||||
zrot = NULL;
|
||||
xoff = NULL;
|
||||
yoff = NULL;
|
||||
zoff = NULL;
|
||||
currentModelFile.clear();
|
||||
|
||||
wxBoxSizer* mainBox = new wxBoxSizer( wxVERTICAL );
|
||||
wxStaticBoxSizer* vbox = new wxStaticBoxSizer( wxVERTICAL, this, _( "3D Preview" ) );
|
||||
|
||||
wxFloatingPointValidator< float > valScale( 4 );
|
||||
valScale.SetRange( 0.0f, 9999.0f );
|
||||
wxFloatingPointValidator< float > valRotate( 2 );
|
||||
valRotate.SetRange( -180.0f, 180.0f );
|
||||
wxFloatingPointValidator< float > valOffset( 4 );
|
||||
valOffset.SetRange( -9999.0f, 9999.0f );
|
||||
|
||||
wxStaticBoxSizer* vbScale = new wxStaticBoxSizer( wxVERTICAL, this, _( "Scale" ) );
|
||||
wxStaticBoxSizer* vbRotate = new wxStaticBoxSizer( wxVERTICAL, this, _( "Rotation (degrees)" ) );
|
||||
|
||||
const wxString offsetString = _( "Offset " ) + "(" + GetUnitsLabel( g_UserUnit ) + ")";
|
||||
wxStaticBoxSizer* vbOffset = new wxStaticBoxSizer( wxVERTICAL, this, offsetString );
|
||||
|
||||
wxStaticBox* modScale = vbScale->GetStaticBox();
|
||||
wxStaticBox* modRotate = vbRotate->GetStaticBox();
|
||||
wxStaticBox* modOffset = vbOffset->GetStaticBox();
|
||||
|
||||
wxBoxSizer* hbS1 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbS2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbS3 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticText* txtS1 = new wxStaticText( modScale, -1, wxT( "X:" ) );
|
||||
wxStaticText* txtS2 = new wxStaticText( modScale, -1, wxT( "Y:" ) );
|
||||
wxStaticText* txtS3 = new wxStaticText( modScale, -1, wxT( "Z:" ) );
|
||||
|
||||
xscale = new wxTextCtrl( modScale, ID_SCALEX, "1", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valScale );
|
||||
yscale = new wxTextCtrl( modScale, ID_SCALEY, "1", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valScale );
|
||||
zscale = new wxTextCtrl( modScale, ID_SCALEZ, "1", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valScale );
|
||||
|
||||
xscale->SetMaxLength( 9 );
|
||||
yscale->SetMaxLength( 9 );
|
||||
zscale->SetMaxLength( 9 );
|
||||
hbS1->Add( txtS1, 0, wxALIGN_CENTER, 2 );
|
||||
hbS1->Add( xscale, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbS2->Add( txtS2, 0, wxALIGN_CENTER, 2 );
|
||||
hbS2->Add( yscale, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbS3->Add( txtS3, 0, wxALIGN_CENTER, 2 );
|
||||
hbS3->Add( zscale, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
vbScale->Add( hbS1, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbScale->Add( hbS2, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbScale->Add( hbS3, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
|
||||
wxBoxSizer* hbR1 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbR2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbR3 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxStaticText* txtR1 = new wxStaticText( modRotate, -1, wxT( "X:" ) );
|
||||
wxStaticText* txtR2 = new wxStaticText( modRotate, -1, wxT( "Y:" ) );
|
||||
wxStaticText* txtR3 = new wxStaticText( modRotate, -1, wxT( "Z:" ) );
|
||||
|
||||
xrot = new wxTextCtrl( modRotate, ID_ROTX, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valRotate );
|
||||
yrot = new wxTextCtrl( modRotate, ID_ROTY, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valRotate );
|
||||
zrot = new wxTextCtrl( modRotate, ID_ROTZ, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valRotate );
|
||||
|
||||
xrot->SetMaxLength( 9 );
|
||||
yrot->SetMaxLength( 9 );
|
||||
zrot->SetMaxLength( 9 );
|
||||
hbR1->Add( txtR1, 1, wxALIGN_CENTER, 2 );
|
||||
hbR1->Add( xrot, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbR2->Add( txtR2, 1, wxALIGN_CENTER, 2 );
|
||||
hbR2->Add( yrot, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbR3->Add( txtR3, 1, wxALIGN_CENTER, 2 );
|
||||
hbR3->Add( zrot, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
vbRotate->Add( hbR1, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbRotate->Add( hbR2, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbRotate->Add( hbR3, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
|
||||
wxBoxSizer* hbO1 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbO2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* hbO3 = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxStaticText* txtO1 = new wxStaticText( modOffset, -1, wxT( "X:" ) );
|
||||
wxStaticText* txtO2 = new wxStaticText( modOffset, -1, wxT( "Y:" ) );
|
||||
wxStaticText* txtO3 = new wxStaticText( modOffset, -1, wxT( "Z:" ) );
|
||||
|
||||
// The default offset is 0.0 or 0,0, depending on floating point separator:
|
||||
xoff = new wxTextCtrl( modOffset, ID_OFFX, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valOffset );
|
||||
yoff = new wxTextCtrl( modOffset, ID_OFFY, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valOffset );
|
||||
zoff = new wxTextCtrl( modOffset, ID_OFFZ, "0", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER, valOffset );
|
||||
xoff->SetMaxLength( 10 );
|
||||
yoff->SetMaxLength( 10 );
|
||||
zoff->SetMaxLength( 10 );
|
||||
hbO1->Add( txtO1, 0, wxALIGN_CENTER, 2 );
|
||||
hbO1->Add( xoff, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbO2->Add( txtO2, 0, wxALIGN_CENTER, 2 );
|
||||
hbO2->Add( yoff, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
hbO3->Add( txtO3, 0, wxALIGN_CENTER, 2 );
|
||||
hbO3->Add( zoff, 0, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
vbOffset->Add( hbO1, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbOffset->Add( hbO2, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
vbOffset->Add( hbO3, 1, wxEXPAND | wxLEFT | wxRIGHT, 6 );
|
||||
|
||||
// hbox holding orientation data and preview
|
||||
wxBoxSizer* hbox = new wxBoxSizer( wxHORIZONTAL );
|
||||
// vbox holding orientation data
|
||||
wxBoxSizer* vboxOrient = new wxBoxSizer( wxVERTICAL );
|
||||
// vbox holding the preview and view buttons
|
||||
wxBoxSizer* vboxPrev = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
vboxOrient->Add( vbScale, 1, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
vboxOrient->Add( vbRotate, 1, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
vboxOrient->Add( vbOffset, 1, wxEXPAND | wxLEFT | wxRIGHT, 2 );
|
||||
|
||||
// add preview items
|
||||
wxPanel*preview = new wxPanel( this, -1 );
|
||||
preview->SetMinSize( wxSize( 400, 250 ) );
|
||||
preview->SetBackgroundColour( wxColor( 0, 0, 0 ));
|
||||
vboxPrev->Add( preview, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
// buttons:
|
||||
wxButton* vFront = new wxButton( this, ID_3D_FRONT );
|
||||
vFront->SetBitmap( KiBitmap( axis3d_front_xpm ) );
|
||||
|
||||
wxButton* vBack = new wxButton( this, ID_3D_BACK );
|
||||
vBack->SetBitmap( KiBitmap( axis3d_back_xpm ) );
|
||||
|
||||
wxButton* vLeft = new wxButton( this, ID_3D_LEFT );
|
||||
vLeft->SetBitmap( KiBitmap( axis3d_left_xpm ) );
|
||||
|
||||
wxButton* vRight = new wxButton( this, ID_3D_RIGHT );
|
||||
vRight->SetBitmap( KiBitmap( axis3d_right_xpm ) );
|
||||
|
||||
wxButton* vTop = new wxButton( this, ID_3D_TOP );
|
||||
vTop->SetBitmap( KiBitmap( axis3d_top_xpm ) );
|
||||
|
||||
wxButton* vBottom = new wxButton( this, ID_3D_BOTTOM );
|
||||
vBottom->SetBitmap( KiBitmap( axis3d_bottom_xpm ) );
|
||||
|
||||
wxToggleButton* vISO = new wxToggleButton( this, ID_3D_ISO, wxT("") );
|
||||
vISO->SetBitmap( KiBitmap( ortho_xpm ) );
|
||||
vISO->SetToolTip( _("Change to isometric perspective") );
|
||||
|
||||
wxButton* vUpdate = new wxButton( this, ID_3D_UPDATE );
|
||||
vUpdate->SetBitmap( KiBitmap( reload_xpm ) );
|
||||
vUpdate->SetToolTip( _("Reload board and 3D models") );
|
||||
|
||||
wxGridSizer* gridSizer = new wxGridSizer( 2, 4, 0, 0 );
|
||||
|
||||
gridSizer->Add( vISO, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vLeft, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vFront, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vTop, 0, wxEXPAND, 3 );
|
||||
|
||||
gridSizer->Add( vUpdate, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vRight, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vBack, 0, wxEXPAND, 3 );
|
||||
gridSizer->Add( vBottom, 0, wxEXPAND, 3 );
|
||||
|
||||
vboxPrev->AddSpacer( 7 );
|
||||
vboxPrev->Add( gridSizer, 0, wxCENTER, 0 );
|
||||
|
||||
hbox->Add( vboxOrient, 0, 0, 2 );
|
||||
hbox->Add( vboxPrev, 1, wxEXPAND | wxALL, 12 );
|
||||
vbox->Add( hbox, 1, wxEXPAND | wxALL, 0 );
|
||||
|
||||
mainBox->Add( vbox, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
SetSizerAndFit( mainBox );
|
||||
|
||||
// Create a dummy board
|
||||
m_dummyBoard = new BOARD();
|
||||
m_dummyBoard->Add( (MODULE*)aModuleCopy );
|
||||
m_copyModule = aModuleCopy;
|
||||
|
||||
// Set 3d viewer configuration for preview
|
||||
m_settings3Dviewer = new CINFO3D_VISU();
|
||||
|
||||
// Create the 3D canvas
|
||||
m_previewPane = new EDA_3D_CANVAS( preview,
|
||||
COGL_ATT_LIST::GetAttributesList( true ),
|
||||
m_dummyBoard,
|
||||
*m_settings3Dviewer,
|
||||
aCacheManager );
|
||||
|
||||
wxSizer* ws = new wxBoxSizer( wxHORIZONTAL );
|
||||
ws->Add( m_previewPane, 1, wxEXPAND );
|
||||
preview->SetSizer( ws );
|
||||
preview->Layout();
|
||||
ws->FitInside( preview );
|
||||
|
||||
m_previewPane->SetFocus(); // Need to catch mouse and keyboard events
|
||||
}
|
||||
|
||||
|
||||
PANEL_PREV_3D::~PANEL_PREV_3D()
|
||||
{
|
||||
delete m_settings3Dviewer;
|
||||
m_settings3Dviewer = NULL;
|
||||
|
||||
delete m_dummyBoard;
|
||||
m_dummyBoard = NULL;
|
||||
|
||||
delete m_previewPane;
|
||||
m_previewPane = NULL;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
|
@ -346,88 +133,6 @@ void PANEL_PREV_3D::OnCloseWindow( wxCloseEvent &event )
|
|||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
|
||||
{
|
||||
if( m_settings3Dviewer )
|
||||
{
|
||||
m_settings3Dviewer->CameraGet().ToggleProjection();
|
||||
m_previewPane->Refresh();
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'X' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'x' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'Y' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'y' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'z' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::View3DBottom( wxCommandEvent& event )
|
||||
{
|
||||
if( m_previewPane )
|
||||
{
|
||||
m_previewPane->SetView3D( 'Z' );
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREV_3D::SetModelDataIdx( int idx, bool aReloadPreviewModule )
|
||||
{
|
||||
wxASSERT( m_parentInfoList != NULL );
|
||||
|
|
|
@ -36,10 +36,14 @@
|
|||
#ifndef PANEL_PREV_MODEL_H
|
||||
#define PANEL_PREV_MODEL_H
|
||||
|
||||
#include <wx/textctrl.h>
|
||||
#include "panel_prev_3d_base.h"
|
||||
|
||||
//#include <wx/textctrl.h>
|
||||
#include "../3d_info.h"
|
||||
#include <vector>
|
||||
|
||||
#include <3d_canvas/eda_3d_canvas.h>
|
||||
|
||||
// Declared classes to create pointers
|
||||
class S3D_CACHE;
|
||||
class S3D_FILENAME_RESOLVER;
|
||||
|
@ -48,37 +52,120 @@ class BOARD;
|
|||
class CINFO3D_VISU;
|
||||
class MODULE;
|
||||
|
||||
#define PANEL_PREV_3D_B PANEL_PREV_3D
|
||||
|
||||
class PANEL_PREV_3D : public wxPanel
|
||||
class PANEL_PREV_3D_B: public PANEL_PREV_3D_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_PREV_3D_B( wxWindow* aParent, S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
std::vector<S3D_INFO> *aParentInfoList = NULL );
|
||||
|
||||
~PANEL_PREV_3D_B();
|
||||
|
||||
private:
|
||||
wxString currentModelFile; ///< Used to check if the model file was changed
|
||||
S3D_FILENAME_RESOLVER *m_resolver; ///< Used to get the full path name
|
||||
|
||||
/// The 3D canvas
|
||||
EDA_3D_CANVAS *m_previewPane;
|
||||
|
||||
/// A dummy board used to store the copy moduled
|
||||
BOARD *m_dummyBoard;
|
||||
|
||||
/// The settings that will be used for this 3D viewer canvas
|
||||
CINFO3D_VISU *m_settings3Dviewer;
|
||||
|
||||
/// A pointer to a new copy of the original module
|
||||
MODULE *m_copyModule;
|
||||
|
||||
/// A pointer to the parent S3D_INFO list that we will use to copy to the preview module
|
||||
std::vector<S3D_INFO> *m_parentInfoList;
|
||||
|
||||
/// The current selected index of the S3D_INFO list
|
||||
int m_currentSelectedIdx;
|
||||
|
||||
/// Current S3D_INFO that is being edited
|
||||
S3D_INFO m_modelInfo;
|
||||
|
||||
// Methods of the class
|
||||
private:
|
||||
void initPanel();
|
||||
|
||||
/**
|
||||
* @brief PANEL_PREV_3D - Creator
|
||||
* @param aParent: the parent windows (or object)
|
||||
* @param aCacheManager: the cache manager to use to resolve the 3D model files
|
||||
* @param aModule: a copy of the original module that is edited. this is for preview propose and
|
||||
* it will be changes, so dont use the original one.
|
||||
* @param aParentInfoList: a pointer to the Info list managed by the parent. This list will be
|
||||
* passed o the aModuleCopy so it will have the updated 3d model shapes list.
|
||||
* @brief updateOrientation - it will receive the events from editing the fields
|
||||
* @param event
|
||||
*/
|
||||
PANEL_PREV_3D( wxWindow* aParent,
|
||||
S3D_CACHE* aCacheManager,
|
||||
MODULE* aModuleCopy,
|
||||
std::vector<S3D_INFO> *aParentInfoList = NULL );
|
||||
void updateOrientation( wxCommandEvent &event ) override;
|
||||
|
||||
~PANEL_PREV_3D();
|
||||
/**
|
||||
* @brief getOrientationVars - gets the transformation from entries and validate it
|
||||
* @param aScale: output scale var
|
||||
* @param aRotation: output rotation var
|
||||
* @param aOffset: output offset var
|
||||
*/
|
||||
void getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset );
|
||||
|
||||
// 3D views buttons
|
||||
void View3DISO( wxCommandEvent& event );
|
||||
void View3DUpdate( wxCommandEvent& event );
|
||||
void View3DLeft( wxCommandEvent& event );
|
||||
void View3DRight( wxCommandEvent& event );
|
||||
void View3DFront( wxCommandEvent& event );
|
||||
void View3DBack( wxCommandEvent& event );
|
||||
void View3DTop( wxCommandEvent& event );
|
||||
void View3DBottom( wxCommandEvent& event );
|
||||
/**
|
||||
* @brief updateListOnModelCopy - copy the current shape list to the copy of module that is on
|
||||
* the preview dummy board
|
||||
*/
|
||||
void updateListOnModelCopy();
|
||||
|
||||
/**
|
||||
* @brief OnCloseWindow - called when the frame is closed
|
||||
* @param event
|
||||
*/
|
||||
void OnCloseWindow( wxCloseEvent &event );
|
||||
|
||||
void onEnterPreviewCanvas( wxMouseEvent& event )
|
||||
{
|
||||
m_previewPane->SetFocus();
|
||||
}
|
||||
|
||||
void View3DISO( wxCommandEvent& event ) override
|
||||
{
|
||||
m_settings3Dviewer->CameraGet().ToggleProjection();
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
void View3DLeft( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'X' );
|
||||
}
|
||||
|
||||
void View3DFront( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'Y' );
|
||||
}
|
||||
|
||||
void View3DTop( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'z' );
|
||||
}
|
||||
|
||||
void View3DUpdate( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
void View3DRight( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'x' );
|
||||
}
|
||||
|
||||
void View3DBack( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'y' );
|
||||
}
|
||||
|
||||
void View3DBottom( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( 'Z' );
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
|
||||
* So we will update our values to edit based on the index on that list.
|
||||
|
@ -107,71 +194,6 @@ public:
|
|||
wxString temp;
|
||||
return ValidateWithMessage(temp);
|
||||
}
|
||||
|
||||
private:
|
||||
wxString currentModelFile; ///< Used to check if the model file was changed
|
||||
S3D_FILENAME_RESOLVER *m_resolver; ///< Used to get the full path name
|
||||
|
||||
// Parameters
|
||||
wxTextCtrl* xscale;
|
||||
wxTextCtrl* yscale;
|
||||
wxTextCtrl* zscale;
|
||||
wxTextCtrl* xrot;
|
||||
wxTextCtrl* yrot;
|
||||
wxTextCtrl* zrot;
|
||||
wxTextCtrl* xoff;
|
||||
wxTextCtrl* yoff;
|
||||
wxTextCtrl* zoff;
|
||||
|
||||
EDA_3D_CANVAS *m_previewPane;
|
||||
|
||||
/// The settings that will be used for this 3D viewer canvas
|
||||
CINFO3D_VISU *m_settings3Dviewer;
|
||||
|
||||
/// A dummy board used to store the copy moduled
|
||||
BOARD *m_dummyBoard;
|
||||
|
||||
/// A pointer to a new copy of the original module
|
||||
MODULE *m_copyModule;
|
||||
|
||||
/// A pointer to the parent S3D_INFO list that we will use to copy to the preview module
|
||||
std::vector<S3D_INFO> *m_parentInfoList;
|
||||
|
||||
/// The current selected index of the S3D_INFO list
|
||||
int m_currentSelectedIdx;
|
||||
|
||||
/// Current S3D_INFO that is being edited
|
||||
S3D_INFO m_modelInfo;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief updateOrientation - it will receive the events from editing the fields
|
||||
* @param event
|
||||
*/
|
||||
void updateOrientation( wxCommandEvent &event );
|
||||
|
||||
/**
|
||||
* @brief getOrientationVars - gets the transformation from entries and validate it
|
||||
* @param aScale: output scale var
|
||||
* @param aRotation: output rotation var
|
||||
* @param aOffset: output offset var
|
||||
*/
|
||||
void getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset );
|
||||
|
||||
/**
|
||||
* @brief updateListOnModelCopy - copy the current shape list to the copy of module that is on
|
||||
* the preview dummy board
|
||||
*/
|
||||
void updateListOnModelCopy();
|
||||
|
||||
/**
|
||||
* @brief OnCloseWindow - called when the frame is closed
|
||||
* @param event
|
||||
*/
|
||||
void OnCloseWindow( wxCloseEvent &event );
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
#endif // PANEL_PREV_MODEL_H
|
||||
|
|
|
@ -38,6 +38,7 @@ set(3D-VIEWER_SRCS
|
|||
${DIR_DLG}/dlg_3d_pathconfig_base.cpp
|
||||
${DIR_DLG}/dlg_3d_pathconfig.cpp
|
||||
${DIR_DLG}/dlg_select_3dmodel.cpp
|
||||
${DIR_DLG}/panel_prev_3d_base.cpp
|
||||
${DIR_DLG}/panel_prev_model.cpp
|
||||
../polygon/poly2tri/common/shapes.cc
|
||||
../polygon/poly2tri/sweep/advancing_front.cc
|
||||
|
|
Loading…
Reference in New Issue