Split the footprint 3d model panel into its own class

This allows it to be shared by both the PCB editor properties dialog
and the fpeditor dialog.
This commit is contained in:
Ian McInerney 2021-07-28 20:22:57 +01:00
parent 293f207356
commit 1a4a3400ba
11 changed files with 1253 additions and 990 deletions

View File

@ -155,6 +155,8 @@ set( PCBNEW_DIALOGS
dialogs/panel_fp_editor_color_settings.cpp dialogs/panel_fp_editor_color_settings.cpp
dialogs/panel_fp_editor_defaults.cpp dialogs/panel_fp_editor_defaults.cpp
dialogs/panel_fp_editor_defaults_base.cpp dialogs/panel_fp_editor_defaults_base.cpp
dialogs/panel_fp_properties_3d_model.cpp
dialogs/panel_fp_properties_3d_model_base.cpp
dialogs/panel_pcbnew_action_plugins.cpp dialogs/panel_pcbnew_action_plugins.cpp
dialogs/panel_pcbnew_action_plugins_base.cpp dialogs/panel_pcbnew_action_plugins_base.cpp
dialogs/panel_pcbnew_color_settings.cpp dialogs/panel_pcbnew_color_settings.cpp

View File

@ -39,6 +39,8 @@
#include <footprint_edit_frame.h> #include <footprint_edit_frame.h>
#include <footprint_editor_settings.h> #include <footprint_editor_settings.h>
#include <dialog_footprint_properties_fp_editor.h> #include <dialog_footprint_properties_fp_editor.h>
#include <panel_fp_properties_3d_model.h>
#include "3d_rendering/legacy/3d_model.h"
#include "filename_resolver.h" #include "filename_resolver.h"
#include <pgm_base.h> #include <pgm_base.h>
#include "3d_cache/dialogs/panel_preview_3d_model.h" #include "3d_cache/dialogs/panel_preview_3d_model.h"
@ -51,28 +53,25 @@
// Remember the last open page during session. // Remember the last open page during session.
int DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::m_page = 0;
enum MODELS_TABLE_COLUMNS NOTEBOOK_PAGES DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::m_page = NOTEBOOK_PAGES::PAGE_GENERAL;
{
COL_PROBLEM = 0,
COL_FILENAME = 1,
COL_SHOWN = 2
};
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
FOOTPRINT_EDIT_FRAME* aParent, FOOTPRINT_EDIT_FRAME* aParent,
FOOTPRINT* aFootprint ) : FOOTPRINT* aFootprint ) :
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE( aParent ), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE( aParent ),
m_frame( aParent ),
m_footprint( aFootprint ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ), m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
m_SolderMaskMarginUnits ), m_SolderMaskMarginUnits ),
m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
m_SolderPasteMarginUnits ), m_SolderPasteMarginUnits )
m_inSelect( false )
{ {
m_frame = aParent; // Create the 3D models page
m_footprint = aFootprint; m_3dPanel = new PANEL_FP_PROPERTIES_3D_MODEL( m_frame, m_footprint, this, m_NoteBook );
m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
m_texts = new FP_TEXT_GRID_TABLE( m_units, m_frame ); m_texts = new FP_TEXT_GRID_TABLE( m_units, m_frame );
@ -81,7 +80,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_delayedFocusGrid = nullptr; m_delayedFocusGrid = nullptr;
m_delayedFocusRow = -1; m_delayedFocusRow = -1;
m_delayedFocusColumn = -1; m_delayedFocusColumn = -1;
m_delayedFocusPage = -1; m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_UNKNOWN;
// Give an icon // Give an icon
wxIcon icon; wxIcon icon;
@ -90,51 +89,14 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
// Give a bit more room for combobox editors // Give a bit more room for combobox editors
m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 ); m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
m_itemsGrid->SetTable( m_texts ); m_itemsGrid->SetTable( m_texts );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) ); m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
GRID_TRICKS* trick = new GRID_TRICKS( m_modelsGrid );
trick->SetTooltipEnable( COL_PROBLEM );
m_modelsGrid->PushEventHandler( trick );
// Show/hide columns according to the user's preference // Show/hide columns according to the user's preference
m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns ); m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns );
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
if( cfg->m_lastFootprint3dDir.IsEmpty() )
{
wxGetEnv( KICAD6_3DMODEL_DIR, &cfg->m_lastFootprint3dDir );
}
// Icon showing warning/error information
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetReadOnly();
m_modelsGrid->SetColAttr( COL_PROBLEM, attr );
// Filename
attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_modelsGrid, &cfg->m_lastFootprint3dDir,
"*.*", true, Prj().GetProjectPath() ) );
m_modelsGrid->SetColAttr( COL_FILENAME, attr );
// Show checkbox
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_modelsGrid->SetColAttr( COL_SHOWN, attr );
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
m_previewPane = new PANEL_PREVIEW_3D_MODEL( m_Panel3D, m_frame, m_footprint, &m_shapes3D_list );
bLowerSizer3D->Add( m_previewPane, 1, wxEXPAND, 5 );
m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() ); m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
// Set font sizes // Set font sizes
@ -150,34 +112,34 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_staticTextInfoValNeg->SetFont( infoFont ); m_staticTextInfoValNeg->SetFont( infoFont );
m_staticTextInfoValPos->SetFont( infoFont ); m_staticTextInfoValPos->SetFont( infoFont );
if( m_page >= 0 ) if( static_cast<int>( m_page ) >= 0 )
m_NoteBook->SetSelection( (unsigned) m_page ); m_NoteBook->SetSelection( (unsigned) m_page );
if( m_page == 0 ) if( m_page == NOTEBOOK_PAGES::PAGE_GENERAL )
{ {
m_delayedFocusGrid = m_itemsGrid; m_delayedFocusGrid = m_itemsGrid;
m_delayedFocusRow = 0; m_delayedFocusRow = 0;
m_delayedFocusColumn = 0; m_delayedFocusColumn = 0;
m_delayedFocusPage = 0; m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_GENERAL;
} }
else if ( m_page == 1 ) else if( m_page == NOTEBOOK_PAGES::PAGE_CLEARANCES )
{
SetInitialFocus( m_NetClearanceCtrl ); SetInitialFocus( m_NetClearanceCtrl );
else }
/* else
{ {
m_delayedFocusGrid = m_modelsGrid; m_delayedFocusGrid = m_modelsGrid;
m_delayedFocusRow = 0; m_delayedFocusRow = 0;
m_delayedFocusColumn = 0; m_delayedFocusColumn = 0;
m_delayedFocusPage = 2; m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_3D_MODELS;
} }
*/
m_sdbSizerStdButtonsOK->SetDefault(); m_sdbSizerStdButtonsOK->SetDefault();
// Configure button logos // Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) ); m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) ); m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_button3DShapeAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_button3DShapeBrowse->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_button3DShapeRemove->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
// wxFormBuilder doesn't include this event... // wxFormBuilder doesn't include this event...
m_itemsGrid->Connect( wxEVT_GRID_CELL_CHANGING, m_itemsGrid->Connect( wxEVT_GRID_CELL_CHANGING,
@ -202,17 +164,11 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR()
// Delete the GRID_TRICKS. // Delete the GRID_TRICKS.
m_itemsGrid->PopEventHandler( true ); m_itemsGrid->PopEventHandler( true );
m_modelsGrid->PopEventHandler( true );
// free the memory used by all models, otherwise models which were m_page = static_cast<NOTEBOOK_PAGES>( m_NoteBook->GetSelection() );
// browsed but not used would consume memory
Prj().Get3DCacheManager()->FlushCache( false );
// the GL canvas has to be visible before it is destroyed // the GL canvas on the 3D models page has to be visible before it is destroyed
m_page = m_NoteBook->GetSelection(); m_NoteBook->SetSelection( static_cast<int>( NOTEBOOK_PAGES::PAGE_3D_MODELS ) );
m_NoteBook->SetSelection( 1 );
delete m_previewPane;
} }
@ -232,7 +188,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
if( !m_PanelGeneral->TransferDataToWindow() ) if( !m_PanelGeneral->TransferDataToWindow() )
return false; return false;
if( !m_Panel3D->TransferDataToWindow() ) if( !m_3dPanel->TransferDataToWindow() )
return false; return false;
// Module Texts // Module Texts
@ -306,40 +262,9 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
} }
// 3D Settings // 3D Settings
m_3dPanel->ReloadModelsFromFootprint();
wxString default_path; // Items grid
wxGetEnv( KICAD6_3DMODEL_DIR, &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
m_shapes3D_list.clear();
m_modelsGrid->DeleteRows( 0, m_modelsGrid->GetNumberRows() );
wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
for( const FP_3DMODEL& model : m_footprint->Models() )
{
m_shapes3D_list.push_back( model );
origPath = model.m_Filename;
if( res && res->SplitAlias( origPath, alias, shortPath ) )
origPath = alias + wxT( ":" ) + shortPath;
m_modelsGrid->AppendRows( 1 );
int row = m_modelsGrid->GetNumberRows() - 1;
m_modelsGrid->SetCellValue( row, COL_FILENAME, origPath );
m_modelsGrid->SetCellValue( row, COL_SHOWN, model.m_Show ? wxT( "1" ) : wxT( "0" ) );
// Must be after the filename is set
updateValidateStatus( row );
}
select3DModel( 0 ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ ) for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
{ {
// Adjust min size to the column label size // Adjust min size to the column label size
@ -364,7 +289,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
} }
m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, true, true, true ) ); m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, true, true, true ) );
m_modelsGrid->SetColSize( COL_SHOWN, m_modelsGrid->GetVisibleWidth( COL_SHOWN, true, false, false ) );
Layout(); Layout();
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() ); adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
@ -373,192 +297,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
} }
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::select3DModel( int aModelIdx )
{
m_inSelect = true;
aModelIdx = std::max( 0, aModelIdx );
aModelIdx = std::min( aModelIdx, m_modelsGrid->GetNumberRows() - 1 );
if( m_modelsGrid->GetNumberRows() )
{
m_modelsGrid->SelectRow( aModelIdx );
m_modelsGrid->SetGridCursor( aModelIdx, COL_FILENAME );
}
m_previewPane->SetSelectedModel( aModelIdx );
m_inSelect = false;
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::On3DModelSelected( wxGridEvent& aEvent )
{
if( !m_inSelect )
select3DModel( aEvent.GetRow() );
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
{
if( aEvent.GetCol() == COL_FILENAME )
{
bool hasAlias = false;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_FILENAME );
filename.Replace( "\n", "" );
filename.Replace( "\r", "" );
filename.Replace( "\t", "" );
if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
{
m_delayedErrorMessage = wxString::Format( _( "Invalid filename: %s" ), filename );
m_delayedFocusGrid = m_modelsGrid;
m_delayedFocusRow = aEvent.GetRow();
m_delayedFocusColumn = aEvent.GetCol();
m_delayedFocusPage = 2;
aEvent.Veto();
}
// if the user has specified an alias in the name then prepend ':'
if( hasAlias )
filename.insert( 0, wxT( ":" ) );
#ifdef __WINDOWS__
// In KiCad files, filenames and paths are stored using Unix notation
filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
m_modelsGrid->SetCellValue( aEvent.GetRow(), COL_FILENAME, filename );
updateValidateStatus( aEvent.GetRow() );
}
else if( aEvent.GetCol() == COL_SHOWN )
{
wxString showValue = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_SHOWN );
m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT( "1" ) );
}
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnRemove3DModel( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
int idx = m_modelsGrid->GetGridCursorRow();
if( idx >= 0 && m_modelsGrid->GetNumberRows() && !m_shapes3D_list.empty() )
{
m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
m_modelsGrid->DeleteRows( idx );
select3DModel( idx ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
}
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
int selected = m_modelsGrid->GetGridCursorRow();
PROJECT& prj = Prj();
FP_3DMODEL model;
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
int filter = 0;
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KICAD6_3DMODEL_DIR environment
// variable and fall back to the project path if necessary.
if( initialpath.IsEmpty() )
{
if( !wxGetEnv( "KICAD6_3DMODEL_DIR", &initialpath ) || initialpath.IsEmpty() )
initialpath = prj.GetProjectPath();
}
if( !sidx.empty() )
{
long tmp;
sidx.ToLong( &tmp );
if( tmp > 0 && tmp <= INT_MAX )
filter = (int) tmp;
}
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
|| model.m_Filename.empty() )
{
select3DModel( selected );
return;
}
prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
sidx = wxString::Format( wxT( "%i" ), filter );
prj.SetRString( PROJECT::VIEWER_3D_FILTER_INDEX, sidx );
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
wxString alias;
wxString shortPath;
wxString filename = model.m_Filename;
if( res && res->SplitAlias( filename, alias, shortPath ) )
filename = alias + wxT( ":" ) + shortPath;
#ifdef __WINDOWS__
// In KiCad files, filenames and paths are stored using Unix notation
model.m_Filename.Replace( "\\", "/" );
#endif
model.m_Show = true;
m_shapes3D_list.push_back( model );
int idx = m_modelsGrid->GetNumberRows();
m_modelsGrid->AppendRows( 1 );
m_modelsGrid->SetCellValue( idx, COL_FILENAME, filename );
m_modelsGrid->SetCellValue( idx, COL_SHOWN, wxT( "1" ) );
updateValidateStatus( idx );
select3DModel( idx );
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAdd3DRow( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
FP_3DMODEL model;
model.m_Show = true;
m_shapes3D_list.push_back( model );
int row = m_modelsGrid->GetNumberRows();
m_modelsGrid->AppendRows( 1 );
m_modelsGrid->SetCellValue( row, COL_SHOWN, wxT( "1" ) );
m_modelsGrid->SetCellValue( row, COL_PROBLEM, "" );
select3DModel( row );
m_modelsGrid->SetFocus();
m_modelsGrid->MakeCellVisible( row, COL_FILENAME );
m_modelsGrid->SetGridCursor( row, COL_FILENAME );
m_modelsGrid->EnableCellEditControl( true );
m_modelsGrid->ShowCellEditControl();
}
bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName( const wxString& aFootprintName ) bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName( const wxString& aFootprintName )
{ {
if( aFootprintName.IsEmpty() ) if( aFootprintName.IsEmpty() )
@ -577,59 +315,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName( const wxString&
} }
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::updateValidateStatus( int aRow )
{
int icon = 0;
wxString errStr;
switch( validateModelExists( m_modelsGrid->GetCellValue( aRow, COL_FILENAME) ) )
{
case MODEL_VALIDATE_ERRORS::MODEL_NO_ERROR:
icon = 0;
errStr = "";
break;
case MODEL_VALIDATE_ERRORS::RESOLVE_FAIL:
icon = wxICON_ERROR;
errStr = _( "File not found" );
break;
case MODEL_VALIDATE_ERRORS::OPEN_FAIL:
icon = wxICON_ERROR;
errStr = _( "Unable to open file" );
break;
default:
icon = wxICON_ERROR;
errStr = _( "Unknown error" );
break;
}
m_modelsGrid->SetCellValue( aRow, COL_PROBLEM, errStr );
m_modelsGrid->SetCellRenderer( aRow, COL_PROBLEM,
new GRID_CELL_STATUS_ICON_RENDERER( icon ) );
}
MODEL_VALIDATE_ERRORS DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::validateModelExists( const wxString& aFilename )
{
FILENAME_RESOLVER* resolv = Prj().Get3DFilenameResolver();
if( !resolv )
return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL;
wxString fullPath = resolv->ResolvePath( aFilename );
if( fullPath.IsEmpty() )
return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL;
if( wxFileName::IsFileReadable( fullPath ) )
return MODEL_VALIDATE_ERRORS::MODEL_NO_ERROR;
else
return MODEL_VALIDATE_ERRORS::OPEN_FAIL;
}
bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate() bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate()
{ {
if( !m_itemsGrid->CommitPendingChanges() ) if( !m_itemsGrid->CommitPendingChanges() )
@ -647,7 +332,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate()
m_NoteBook->SetSelection( 0 ); m_NoteBook->SetSelection( 0 );
m_delayedFocusCtrl = m_FootprintNameCtrl; m_delayedFocusCtrl = m_FootprintNameCtrl;
m_delayedFocusPage = 0; m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_GENERAL;
return false; return false;
} }
@ -689,7 +374,8 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
if( !m_itemsGrid->CommitPendingChanges() ) if( !m_itemsGrid->CommitPendingChanges() )
return false; return false;
if( !m_modelsGrid->CommitPendingChanges() ) // This only commits the editor, model updating is done below
if( !m_3dPanel->TransferDataFromWindow() )
return false; return false;
auto view = m_frame->GetCanvas()->GetView(); auto view = m_frame->GetCanvas()->GetView();
@ -795,9 +481,11 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break; case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break;
} }
std::list<FP_3DMODEL>* draw3D = &m_footprint->Models(); // Copy the models from the panel to the footprint
draw3D->clear(); std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() ); std::list<FP_3DMODEL>* fpList = &m_footprint->Models();
fpList->clear();
fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
commit.Push( _( "Modify footprint properties" ) ); commit.Push( _( "Modify footprint properties" ) );
@ -888,18 +576,10 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnDeleteField( wxCommandEvent& event
} }
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Cfg3DPath( wxCommandEvent& event )
{
if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::adjustGridColumns( int aWidth ) void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::adjustGridColumns( int aWidth )
{ {
// Account for scroll bars // Account for scroll bars
int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x ); int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
int modelsWidth = aWidth - ( m_modelsGrid->GetSize().x - m_modelsGrid->GetClientSize().x );
itemsWidth -= m_itemsGrid->GetRowLabelSize(); itemsWidth -= m_itemsGrid->GetRowLabelSize();
@ -912,16 +592,14 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::adjustGridColumns( int aWidth )
m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) ); m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
} }
int width = modelsWidth - m_modelsGrid->GetColSize( COL_SHOWN ) // Update the width of the 3D panel
- m_modelsGrid->GetColSize( COL_PROBLEM ) - 5; m_3dPanel->AdjustGridColumnWidths( aWidth );
m_modelsGrid->SetColSize( COL_FILENAME, width );
} }
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event ) void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
{ {
if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() ) if( !m_itemsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() ); adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
if( m_itemsGrid->IsCellEditControlShown() ) if( m_itemsGrid->IsCellEditControlShown() )
@ -934,12 +612,12 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
// b) show the correct notebook page in the background before the error dialog comes up // b) show the correct notebook page in the background before the error dialog comes up
// when triggered from an OK or a notebook page change // when triggered from an OK or a notebook page change
if( m_delayedFocusPage >= 0 ) if( static_cast<int>( m_delayedFocusPage ) >= 0 )
{ {
if( m_NoteBook->GetSelection() != m_delayedFocusPage ) if( m_NoteBook->GetSelection() != static_cast<int>( m_delayedFocusPage ) )
m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage ); m_NoteBook->SetSelection( static_cast<int>( m_delayedFocusPage ) );
m_delayedFocusPage = -1; m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_UNKNOWN;
} }
if( !m_delayedErrorMessage.IsEmpty() ) if( !m_delayedErrorMessage.IsEmpty() )
@ -975,8 +653,6 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
m_delayedFocusRow = -1; m_delayedFocusRow = -1;
m_delayedFocusColumn = -1; m_delayedFocusColumn = -1;
} }
m_button3DShapeRemove->Enable( m_modelsGrid->GetNumberRows() > 0 );
} }

View File

@ -32,15 +32,16 @@
#include <dialog_footprint_properties_fp_editor_base.h> #include <dialog_footprint_properties_fp_editor_base.h>
class PANEL_PREVIEW_3D_MODEL;
class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_EDIT_FRAME;
class PANEL_FP_PROPERTIES_3D_MODEL;
enum class MODEL_VALIDATE_ERRORS enum class NOTEBOOK_PAGES
{ {
MODEL_NO_ERROR, PAGE_UNKNOWN = -1,
RESOLVE_FAIL, PAGE_GENERAL = 0,
OPEN_FAIL PAGE_CLEARANCES = 1,
PAGE_3D_MODELS = 2
}; };
class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR : public DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR : public DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE
@ -56,12 +57,6 @@ public:
private: private:
// virtual event functions // virtual event functions
void On3DModelSelected( wxGridEvent& ) override;
void On3DModelCellChanged( wxGridEvent& aEvent ) override;
void OnRemove3DModel( wxCommandEvent& event ) override;
void OnAdd3DModel( wxCommandEvent& event ) override;
void OnAdd3DRow( wxCommandEvent& event ) override;
void Cfg3DPath( wxCommandEvent& event ) override;
void OnGridSize( wxSizeEvent& event ) override; void OnGridSize( wxSizeEvent& event ) override;
void OnFootprintNameText( wxCommandEvent& event ) override; void OnFootprintNameText( wxCommandEvent& event ) override;
void OnGridCellChanging( wxGridEvent& event ); void OnGridCellChanging( wxGridEvent& event );
@ -69,21 +64,15 @@ private:
void OnDeleteField( wxCommandEvent& event ) override; void OnDeleteField( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override; void OnUpdateUI( wxUpdateUIEvent& event ) override;
void updateValidateStatus( int aRow );
MODEL_VALIDATE_ERRORS validateModelExists( const wxString& aFilename );
bool checkFootprintName( const wxString& aFootprintName ); bool checkFootprintName( const wxString& aFootprintName );
void select3DModel( int aModelIdx );
void adjustGridColumns( int aWidth ); void adjustGridColumns( int aWidth );
private: private:
FOOTPRINT_EDIT_FRAME* m_frame; FOOTPRINT_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint; FOOTPRINT* m_footprint;
static int m_page; // remember the last open page during session static NOTEBOOK_PAGES m_page; // remember the last open page during session
FP_TEXT_GRID_TABLE* m_texts; FP_TEXT_GRID_TABLE* m_texts;
@ -91,18 +80,15 @@ private:
UNIT_BINDER m_solderMask; UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste; UNIT_BINDER m_solderPaste;
std::vector<FP_3DMODEL> m_shapes3D_list;
PANEL_PREVIEW_3D_MODEL* m_previewPane;
wxControl* m_delayedFocusCtrl; wxControl* m_delayedFocusCtrl;
int m_delayedFocusPage; NOTEBOOK_PAGES m_delayedFocusPage;
WX_GRID* m_delayedFocusGrid; WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow; int m_delayedFocusRow;
int m_delayedFocusColumn; int m_delayedFocusColumn;
wxString m_delayedErrorMessage; wxString m_delayedErrorMessage;
bool m_inSelect; PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel;
}; };

View File

@ -332,81 +332,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_PanelClearances->Layout(); m_PanelClearances->Layout();
bSizerPanelClearances->Fit( m_PanelClearances ); bSizerPanelClearances->Fit( m_PanelClearances );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), false ); m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), false );
m_Panel3D = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizerMain3D = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_Panel3D, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_modelsGrid = new WX_GRID( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE );
// Grid
m_modelsGrid->CreateGrid( 3, 3 );
m_modelsGrid->EnableEditing( true );
m_modelsGrid->EnableGridLines( false );
m_modelsGrid->EnableDragGridSize( false );
m_modelsGrid->SetMargins( 0, 0 );
// Columns
m_modelsGrid->SetColSize( 0, 20 );
m_modelsGrid->SetColSize( 1, 650 );
m_modelsGrid->SetColSize( 2, 65 );
m_modelsGrid->EnableDragColMove( false );
m_modelsGrid->EnableDragColSize( false );
m_modelsGrid->SetColLabelSize( 22 );
m_modelsGrid->SetColLabelValue( 0, wxEmptyString );
m_modelsGrid->SetColLabelValue( 1, _("3D Model(s)") );
m_modelsGrid->SetColLabelValue( 2, _("Show") );
m_modelsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Rows
m_modelsGrid->EnableDragRowSize( false );
m_modelsGrid->SetRowLabelSize( 0 );
m_modelsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_modelsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizer3->Add( m_modelsGrid, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
m_button3DShapeAdd = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeAdd, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_button3DShapeBrowse = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeBrowse, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizer3DButtons->Add( 20, 0, 0, 0, 5 );
m_button3DShapeRemove = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeRemove, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonConfig3DPaths = new wxButton( sbSizer3->GetStaticBox(), wxID_ANY, _("Configure Paths..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonConfig3DPaths, 0, wxALL, 5 );
sbSizer3->Add( bSizer3DButtons, 0, wxEXPAND, 5 );
bSizerMain3D->Add( sbSizer3, 4, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bLowerSizer3D = new wxBoxSizer( wxHORIZONTAL );
bSizerMain3D->Add( bLowerSizer3D, 11, wxEXPAND, 5 );
m_Panel3D->SetSizer( bSizerMain3D );
m_Panel3D->Layout();
bSizerMain3D->Fit( m_Panel3D );
m_NoteBook->AddPage( m_Panel3D, _("3D Models"), false );
m_GeneralBoxSizer->Add( m_NoteBook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_GeneralBoxSizer->Add( m_NoteBook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -437,12 +362,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this ); m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this ); m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this );
m_FootprintNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this ); m_FootprintNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_button3DShapeAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAdd3DRow ), NULL, this );
m_button3DShapeBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAdd3DModel ), NULL, this );
m_button3DShapeRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnRemove3DModel ), NULL, this );
m_buttonConfig3DPaths->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::Cfg3DPath ), NULL, this );
} }
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE() DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE()
@ -454,11 +373,5 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDIT
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this ); m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this ); m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this );
m_FootprintNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this ); m_FootprintNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_button3DShapeAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAdd3DRow ), NULL, this );
m_button3DShapeBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAdd3DModel ), NULL, this );
m_button3DShapeRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnRemove3DModel ), NULL, this );
m_buttonConfig3DPaths->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::Cfg3DPath ), NULL, this );
} }

View File

@ -2788,507 +2788,6 @@
</object> </object>
</object> </object>
</object> </object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">3D Models</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_Panel3D</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain3D</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">4</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
<property name="minimum_size"></property>
<property name="name">sbSizer3</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;&quot; &quot;3D Model(s)&quot; &quot;Show&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property>
<property name="column_sizes">20,650,65</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">0</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_modelsGrid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE</property>
<event name="OnGridCellChange">On3DModelCellChanged</event>
<event name="OnGridSelectCell">On3DModelSelected</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3DButtons</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add 3D Model</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeAdd</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAdd3DRow</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Browse</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeBrowse</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAdd3DModel</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Remove 3D Model</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeRemove</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemove3DModel</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Configure Paths...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonConfig3DPaths</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">Cfg3DPath</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">11</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bLowerSizer3D</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
</object>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -90,14 +90,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextInfoPaste; wxStaticText* m_staticTextInfoPaste;
wxStaticText* m_staticText16; wxStaticText* m_staticText16;
wxChoice* m_ZoneConnectionChoice; wxChoice* m_ZoneConnectionChoice;
wxPanel* m_Panel3D;
wxBoxSizer* bSizerMain3D;
WX_GRID* m_modelsGrid;
wxBitmapButton* m_button3DShapeAdd;
wxBitmapButton* m_button3DShapeBrowse;
wxBitmapButton* m_button3DShapeRemove;
wxButton* m_buttonConfig3DPaths;
wxBoxSizer* bLowerSizer3D;
wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel; wxButton* m_sdbSizerStdButtonsCancel;
@ -109,12 +101,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE : public DIALOG_SHIM
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); } virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFootprintNameText( wxCommandEvent& event ) { event.Skip(); } virtual void OnFootprintNameText( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DModelCellChanged( wxGridEvent& event ) { event.Skip(); }
virtual void On3DModelSelected( wxGridEvent& event ) { event.Skip(); }
virtual void OnAdd3DRow( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAdd3DModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemove3DModel( wxCommandEvent& event ) { event.Skip(); }
virtual void Cfg3DPath( wxCommandEvent& event ) { event.Skip(); }
public: public:

View File

@ -0,0 +1,429 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2021 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
*/
#include <panel_fp_properties_3d_model.h>
#include <confirm.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <board_design_settings.h>
#include <bitmaps.h>
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/grid_text_button_helpers.h>
#include <widgets/wx_grid.h>
#include <footprint.h>
#include <footprint_edit_frame.h>
#include <footprint_editor_settings.h>
#include <dialog_footprint_properties_fp_editor.h>
#include "filename_resolver.h"
#include <pgm_base.h>
#include "3d_cache/dialogs/panel_preview_3d_model.h"
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include <settings/settings_manager.h>
#include <kiway_holder.h>
enum MODELS_TABLE_COLUMNS
{
COL_PROBLEM = 0,
COL_FILENAME = 1,
COL_SHOWN = 2
};
PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(
FOOTPRINT_EDIT_FRAME* aFrame, FOOTPRINT* aFootprint, DIALOG_SHIM* aDialogParent,
wxWindow* aParent, wxWindowID aId, const wxPoint& aPos, const wxSize& aSize, long aStyle,
const wxString& aName ) :
PANEL_FP_PROPERTIES_3D_MODEL_BASE( aParent, aId, aPos, aSize, aStyle, aName ),
m_parentDialog( aDialogParent ),
m_frame( aFrame ),
m_footprint( aFootprint ),
m_inSelect( false )
{
m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
GRID_TRICKS* trick = new GRID_TRICKS( m_modelsGrid );
trick->SetTooltipEnable( COL_PROBLEM );
m_modelsGrid->PushEventHandler( trick );
// Get the last 3D directory
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
if( cfg->m_lastFootprint3dDir.IsEmpty() )
wxGetEnv( KICAD6_3DMODEL_DIR, &cfg->m_lastFootprint3dDir );
// Icon showing warning/error information
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetReadOnly();
m_modelsGrid->SetColAttr( COL_PROBLEM, attr );
// Filename
attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parentDialog, m_modelsGrid, &cfg->m_lastFootprint3dDir,
"*.*", true, m_frame->Prj().GetProjectPath() ) );
m_modelsGrid->SetColAttr( COL_FILENAME, attr );
// Show checkbox
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_modelsGrid->SetColAttr( COL_SHOWN, attr );
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
m_frame->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
m_previewPane = new PANEL_PREVIEW_3D_MODEL( this, m_frame, m_footprint, &m_shapes3D_list );
bLowerSizer3D->Add( m_previewPane, 1, wxEXPAND, 5 );
// Configure button logos
m_button3DShapeAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_button3DShapeBrowse->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_button3DShapeRemove->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
}
PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL()
{
// Delete the GRID_TRICKS.
m_modelsGrid->PopEventHandler( true );
// free the memory used by all models, otherwise models which were
// browsed but not used would consume memory
m_frame->Prj().Get3DCacheManager()->FlushCache( false );
delete m_previewPane;
}
bool PANEL_FP_PROPERTIES_3D_MODEL::TransferDataFromWindow()
{
// Only commit changes in the editor, not the models
// The container dialog is responsible for moving the new models into
// the footprint inside a commit.
if( !m_modelsGrid->CommitPendingChanges() )
return false;
return true;
}
void PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint()
{
wxString default_path;
wxGetEnv( KICAD6_3DMODEL_DIR, &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
m_shapes3D_list.clear();
m_modelsGrid->DeleteRows( 0, m_modelsGrid->GetNumberRows() );
wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver();
for( const FP_3DMODEL& model : m_footprint->Models() )
{
m_shapes3D_list.push_back( model );
origPath = model.m_Filename;
if( res && res->SplitAlias( origPath, alias, shortPath ) )
origPath = alias + wxT( ":" ) + shortPath;
m_modelsGrid->AppendRows( 1 );
int row = m_modelsGrid->GetNumberRows() - 1;
m_modelsGrid->SetCellValue( row, COL_FILENAME, origPath );
m_modelsGrid->SetCellValue( row, COL_SHOWN, model.m_Show ? wxT( "1" ) : wxT( "0" ) );
// Must be after the filename is set
updateValidateStatus( row );
}
select3DModel( 0 ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
m_modelsGrid->SetColSize( COL_SHOWN, m_modelsGrid->GetVisibleWidth( COL_SHOWN, true, false, false ) );
Layout();
}
void PANEL_FP_PROPERTIES_3D_MODEL::select3DModel( int aModelIdx )
{
m_inSelect = true;
aModelIdx = std::max( 0, aModelIdx );
aModelIdx = std::min( aModelIdx, m_modelsGrid->GetNumberRows() - 1 );
if( m_modelsGrid->GetNumberRows() )
{
m_modelsGrid->SelectRow( aModelIdx );
m_modelsGrid->SetGridCursor( aModelIdx, COL_FILENAME );
}
m_previewPane->SetSelectedModel( aModelIdx );
m_inSelect = false;
}
void PANEL_FP_PROPERTIES_3D_MODEL::On3DModelSelected( wxGridEvent& aEvent )
{
if( !m_inSelect )
select3DModel( aEvent.GetRow() );
}
void PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged( wxGridEvent& aEvent )
{
if( aEvent.GetCol() == COL_FILENAME )
{
bool hasAlias = false;
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_FILENAME );
filename.Replace( "\n", "" );
filename.Replace( "\r", "" );
filename.Replace( "\t", "" );
if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
aEvent.Veto();
// if the user has specified an alias in the name then prepend ':'
if( hasAlias )
filename.insert( 0, wxT( ":" ) );
#ifdef __WINDOWS__
// In KiCad files, filenames and paths are stored using Unix notation
filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
m_modelsGrid->SetCellValue( aEvent.GetRow(), COL_FILENAME, filename );
updateValidateStatus( aEvent.GetRow() );
}
else if( aEvent.GetCol() == COL_SHOWN )
{
wxString showValue = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_SHOWN );
m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT( "1" ) );
}
m_previewPane->UpdateDummyFootprint();
}
void PANEL_FP_PROPERTIES_3D_MODEL::OnRemove3DModel( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
int idx = m_modelsGrid->GetGridCursorRow();
if( idx >= 0 && m_modelsGrid->GetNumberRows() && !m_shapes3D_list.empty() )
{
m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
m_modelsGrid->DeleteRows( idx );
select3DModel( idx ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
}
}
void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
int selected = m_modelsGrid->GetGridCursorRow();
PROJECT& prj = m_frame->Prj();
FP_3DMODEL model;
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
int filter = 0;
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KICAD6_3DMODEL_DIR environment
// variable and fall back to the project path if necessary.
if( initialpath.IsEmpty() )
{
if( !wxGetEnv( "KICAD6_3DMODEL_DIR", &initialpath ) || initialpath.IsEmpty() )
initialpath = prj.GetProjectPath();
}
if( !sidx.empty() )
{
long tmp;
sidx.ToLong( &tmp );
if( tmp > 0 && tmp <= INT_MAX )
filter = (int) tmp;
}
if( !S3D::Select3DModel( this, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model )
|| model.m_Filename.empty() )
{
select3DModel( selected );
return;
}
prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
sidx = wxString::Format( wxT( "%i" ), filter );
prj.SetRString( PROJECT::VIEWER_3D_FILTER_INDEX, sidx );
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver();
wxString alias;
wxString shortPath;
wxString filename = model.m_Filename;
if( res && res->SplitAlias( filename, alias, shortPath ) )
filename = alias + wxT( ":" ) + shortPath;
#ifdef __WINDOWS__
// In KiCad files, filenames and paths are stored using Unix notation
model.m_Filename.Replace( "\\", "/" );
#endif
model.m_Show = true;
m_shapes3D_list.push_back( model );
int idx = m_modelsGrid->GetNumberRows();
m_modelsGrid->AppendRows( 1 );
m_modelsGrid->SetCellValue( idx, COL_FILENAME, filename );
m_modelsGrid->SetCellValue( idx, COL_SHOWN, wxT( "1" ) );
updateValidateStatus( idx );
select3DModel( idx );
m_previewPane->UpdateDummyFootprint();
}
void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DRow( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
FP_3DMODEL model;
model.m_Show = true;
m_shapes3D_list.push_back( model );
int row = m_modelsGrid->GetNumberRows();
m_modelsGrid->AppendRows( 1 );
m_modelsGrid->SetCellValue( row, COL_SHOWN, wxT( "1" ) );
m_modelsGrid->SetCellValue( row, COL_PROBLEM, "" );
select3DModel( row );
m_modelsGrid->SetFocus();
m_modelsGrid->MakeCellVisible( row, COL_FILENAME );
m_modelsGrid->SetGridCursor( row, COL_FILENAME );
m_modelsGrid->EnableCellEditControl( true );
m_modelsGrid->ShowCellEditControl();
}
void PANEL_FP_PROPERTIES_3D_MODEL::updateValidateStatus( int aRow )
{
int icon = 0;
wxString errStr;
switch( validateModelExists( m_modelsGrid->GetCellValue( aRow, COL_FILENAME) ) )
{
case MODEL_VALIDATE_ERRORS::MODEL_NO_ERROR:
icon = 0;
errStr = "";
break;
case MODEL_VALIDATE_ERRORS::RESOLVE_FAIL:
icon = wxICON_ERROR;
errStr = _( "File not found" );
break;
case MODEL_VALIDATE_ERRORS::OPEN_FAIL:
icon = wxICON_ERROR;
errStr = _( "Unable to open file" );
break;
default:
icon = wxICON_ERROR;
errStr = _( "Unknown error" );
break;
}
m_modelsGrid->SetCellValue( aRow, COL_PROBLEM, errStr );
m_modelsGrid->SetCellRenderer( aRow, COL_PROBLEM,
new GRID_CELL_STATUS_ICON_RENDERER( icon ) );
}
MODEL_VALIDATE_ERRORS PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists( const wxString& aFilename )
{
FILENAME_RESOLVER* resolv = m_frame->Prj().Get3DFilenameResolver();
if( !resolv )
return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL;
wxString fullPath = resolv->ResolvePath( aFilename );
if( fullPath.IsEmpty() )
return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL;
if( wxFileName::IsFileReadable( fullPath ) )
return MODEL_VALIDATE_ERRORS::MODEL_NO_ERROR;
else
return MODEL_VALIDATE_ERRORS::OPEN_FAIL;
}
void PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath( wxCommandEvent& event )
{
if( S3D::Configure3DPaths( this, m_frame->Prj().Get3DCacheManager()->GetResolver() ) )
m_previewPane->UpdateDummyFootprint();
}
void PANEL_FP_PROPERTIES_3D_MODEL::AdjustGridColumnWidths( int aWidth )
{
// Account for scroll bars
int modelsWidth = aWidth - ( m_modelsGrid->GetSize().x - m_modelsGrid->GetClientSize().x );
int width = modelsWidth - m_modelsGrid->GetColSize( COL_SHOWN )
- m_modelsGrid->GetColSize( COL_PROBLEM ) - 5;
m_modelsGrid->SetColSize( COL_FILENAME, width );
}
void PANEL_FP_PROPERTIES_3D_MODEL::OnUpdateUI( wxUpdateUIEvent& event )
{
m_button3DShapeRemove->Enable( m_modelsGrid->GetNumberRows() > 0 );
}

View File

@ -0,0 +1,97 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2015 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
*/
#ifndef PANEL_FP_PROPERTIES_3D_MODEL_H_
#define PANEL_FP_PROPERTIES_3D_MODEL_H_
#include <footprint.h>
#include <panel_fp_properties_3d_model_base.h>
#include <vector>
class DIALOG_SHIM;
class FOOTPRINT_EDIT_FRAME;
class PANEL_PREVIEW_3D_MODEL;
enum class MODEL_VALIDATE_ERRORS
{
MODEL_NO_ERROR,
RESOLVE_FAIL,
OPEN_FAIL
};
class PANEL_FP_PROPERTIES_3D_MODEL : public PANEL_FP_PROPERTIES_3D_MODEL_BASE
{
public:
PANEL_FP_PROPERTIES_3D_MODEL( FOOTPRINT_EDIT_FRAME* aFrame, FOOTPRINT* aFootprint,
DIALOG_SHIM* aDialogParent, wxWindow* aParent,
wxWindowID aId = wxID_ANY,
const wxPoint& aPos = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize,
long aStyle = wxTAB_TRAVERSAL,
const wxString& aName = wxEmptyString );
~PANEL_FP_PROPERTIES_3D_MODEL() override;
bool TransferDataFromWindow() override;
void ReloadModelsFromFootprint();
void AdjustGridColumnWidths( int aWidth );
std::vector<FP_3DMODEL>& GetModelList()
{
return m_shapes3D_list;
}
private:
// virtual event functions
void On3DModelSelected( wxGridEvent& ) override;
void On3DModelCellChanged( wxGridEvent& aEvent ) override;
void OnRemove3DModel( wxCommandEvent& event ) override;
void OnAdd3DModel( wxCommandEvent& event ) override;
void OnAdd3DRow( wxCommandEvent& event ) override;
void Cfg3DPath( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void updateValidateStatus( int aRow );
MODEL_VALIDATE_ERRORS validateModelExists( const wxString& aFilename );
void select3DModel( int aModelIdx );
private:
DIALOG_SHIM* m_parentDialog;
FOOTPRINT_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint;
std::vector<FP_3DMODEL> m_shapes3D_list;
PANEL_PREVIEW_3D_MODEL* m_previewPane;
bool m_inSelect;
};
#endif // PANEL_FP_PROPERTIES_3D_MODEL_H_

View File

@ -0,0 +1,111 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "panel_fp_properties_3d_model_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_FP_PROPERTIES_3D_MODEL_BASE::PANEL_FP_PROPERTIES_3D_MODEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
bSizerMain3D = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_modelsGrid = new WX_GRID( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE );
// Grid
m_modelsGrid->CreateGrid( 3, 3 );
m_modelsGrid->EnableEditing( true );
m_modelsGrid->EnableGridLines( false );
m_modelsGrid->EnableDragGridSize( false );
m_modelsGrid->SetMargins( 0, 0 );
// Columns
m_modelsGrid->SetColSize( 0, 20 );
m_modelsGrid->SetColSize( 1, 650 );
m_modelsGrid->SetColSize( 2, 65 );
m_modelsGrid->EnableDragColMove( false );
m_modelsGrid->EnableDragColSize( false );
m_modelsGrid->SetColLabelSize( 22 );
m_modelsGrid->SetColLabelValue( 0, wxEmptyString );
m_modelsGrid->SetColLabelValue( 1, _("3D Model(s)") );
m_modelsGrid->SetColLabelValue( 2, _("Show") );
m_modelsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Rows
m_modelsGrid->EnableDragRowSize( false );
m_modelsGrid->SetRowLabelSize( 0 );
m_modelsGrid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_modelsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizer3->Add( m_modelsGrid, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
m_button3DShapeAdd = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeAdd, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_button3DShapeBrowse = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeBrowse, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizer3DButtons->Add( 20, 0, 0, 0, 5 );
m_button3DShapeRemove = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_button3DShapeRemove, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonConfig3DPaths = new wxButton( sbSizer3->GetStaticBox(), wxID_ANY, _("Configure Paths..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonConfig3DPaths, 0, wxALL, 5 );
sbSizer3->Add( bSizer3DButtons, 0, wxEXPAND, 5 );
bSizerMain3D->Add( sbSizer3, 4, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bLowerSizer3D = new wxBoxSizer( wxHORIZONTAL );
bSizerMain3D->Add( bLowerSizer3D, 11, wxEXPAND, 5 );
this->SetSizer( bSizerMain3D );
this->Layout();
bSizerMain3D->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnUpdateUI ) );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::On3DModelSelected ), NULL, this );
m_button3DShapeAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnAdd3DRow ), NULL, this );
m_button3DShapeBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnAdd3DModel ), NULL, this );
m_button3DShapeRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnRemove3DModel ), NULL, this );
m_buttonConfig3DPaths->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::Cfg3DPath ), NULL, this );
}
PANEL_FP_PROPERTIES_3D_MODEL_BASE::~PANEL_FP_PROPERTIES_3D_MODEL_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnUpdateUI ) );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::On3DModelSelected ), NULL, this );
m_button3DShapeAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnAdd3DRow ), NULL, this );
m_button3DShapeBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnAdd3DModel ), NULL, this );
m_button3DShapeRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::OnRemove3DModel ), NULL, this );
m_buttonConfig3DPaths->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_PROPERTIES_3D_MODEL_BASE::Cfg3DPath ), NULL, this );
}

View File

@ -0,0 +1,499 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_fp_properties_3d_model_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">panel_fp_properties_3d_model</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_FP_PROPERTIES_3D_MODEL_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain3D</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">4</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
<property name="minimum_size"></property>
<property name="name">sbSizer3</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;&quot; &quot;3D Model(s)&quot; &quot;Show&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property>
<property name="column_sizes">20,650,65</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">0</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_modelsGrid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE</property>
<event name="OnGridCellChange">On3DModelCellChanged</event>
<event name="OnGridSelectCell">On3DModelSelected</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3DButtons</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add 3D Model</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeAdd</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAdd3DRow</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Browse</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeBrowse</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAdd3DModel</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Remove 3D Model</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3DShapeRemove</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemove3DModel</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Configure Paths...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonConfig3DPaths</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">Cfg3DPath</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">11</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bLowerSizer3D</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,65 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_FP_PROPERTIES_3D_MODEL_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_FP_PROPERTIES_3D_MODEL_BASE : public wxPanel
{
private:
protected:
wxBoxSizer* bSizerMain3D;
WX_GRID* m_modelsGrid;
wxBitmapButton* m_button3DShapeAdd;
wxBitmapButton* m_button3DShapeBrowse;
wxBitmapButton* m_button3DShapeRemove;
wxButton* m_buttonConfig3DPaths;
wxBoxSizer* bLowerSizer3D;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void On3DModelCellChanged( wxGridEvent& event ) { event.Skip(); }
virtual void On3DModelSelected( wxGridEvent& event ) { event.Skip(); }
virtual void OnAdd3DRow( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAdd3DModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemove3DModel( wxCommandEvent& event ) { event.Skip(); }
virtual void Cfg3DPath( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_FP_PROPERTIES_3D_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_FP_PROPERTIES_3D_MODEL_BASE();
};