Switch the board footprint properties window to use the new 3d models panel

This allows it to also get the badge showing errors in the panel.
This commit is contained in:
Ian McInerney 2021-07-28 20:54:20 +01:00
parent 1a4a3400ba
commit befd30a1a1
8 changed files with 57 additions and 929 deletions

View File

@ -41,6 +41,8 @@
#include <widgets/wx_grid.h>
#include <settings/settings_manager.h>
#include <panel_fp_properties_3d_model.h>
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include "3d_cache/dialogs/panel_preview_3d_model.h"
@ -53,18 +55,19 @@ int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page
DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent,
FOOTPRINT* aFootprint ) :
DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_footprint( aFootprint ),
m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
m_orientValidator( 3, &m_orientValue ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_SolderPasteMarginUnits ),
m_initialFocus( true ),
m_inSelect( false )
m_returnValue( FP_PROPS_CANCEL )
{
m_frame = aParent;
m_footprint = aFootprint;
m_returnValue = FP_PROPS_CANCEL;
// Create the 3D models page
m_3dPanel = new PANEL_FP_PROPERTIES_3D_MODEL( m_frame, m_footprint, this, m_NoteBook );
m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
// Configure display origin transforms
m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
@ -87,48 +90,19 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
// Give a bit more room for combobox editors
m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
m_itemsGrid->SetTable( m_texts );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
// Show/hide text item columns according to the user's preference
m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
// Set up the 3D models grid
// Path selector
if( cfg->m_lastFootprint3dDir.IsEmpty() )
{
wxGetEnv( KICAD6_3DMODEL_DIR, &cfg->m_lastFootprint3dDir );
}
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_modelsGrid, &cfg->m_lastFootprint3dDir,
"*.*", true, Prj().GetProjectPath() ) );
m_modelsGrid->SetColAttr( 0, 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( 1, attr );
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
m_modelsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
m_orientValidator.SetRange( -360.0, 360.0 );
m_OrientValueCtrl->SetValidator( m_orientValidator );
m_orientValidator.SetWindow( m_OrientValueCtrl );
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 );
// Set font size for items showing long strings:
wxFont infoFont = KIUI::GetInfoFont();
#if __WXMAC__
@ -153,16 +127,10 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_delayedFocusRow = 0;
m_delayedFocusColumn = 0;
}
else if ( m_page == 1 )
else if( m_page == 1 )
{
SetInitialFocus( m_NetClearanceCtrl );
}
else
{
m_delayedFocusGrid = m_modelsGrid;
m_delayedFocusRow = 0;
m_delayedFocusColumn = 0;
}
m_sdbSizerStdButtonsOK->SetDefault();
@ -171,9 +139,6 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_buttonAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_buttonBrowse->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_buttonRemove->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
finishDialogSettings();
}
@ -189,7 +154,6 @@ DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
// Delete the GRID_TRICKS.
m_itemsGrid->PopEventHandler( true );
m_modelsGrid->PopEventHandler( true );
// free the memory used by all models, otherwise models which were
// browsed but not used would consume memory
@ -198,8 +162,6 @@ DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
// the GL canvas has to be visible before it is destroyed
m_page = m_NoteBook->GetSelection();
m_NoteBook->SetSelection( 1 );
delete m_previewPane;
}
@ -286,11 +248,11 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
if( !m_PanelGeneral->TransferDataToWindow() )
return false;
if( !m_Panel3D->TransferDataToWindow() )
// Add the models to the panel
if( !m_3dPanel->TransferDataToWindow() )
return false;
// Footprint Texts
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
@ -381,30 +343,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
}
// 3D Settings
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, 0, origPath );
m_modelsGrid->SetCellValue( row, 1, model.m_Show ? wxT( "1" ) : wxT( "0" ) );
}
select3DModel( 0 ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
// Show the footprint's FPID.
m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
@ -431,7 +369,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
}
m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, false, true, true ) );
m_modelsGrid->SetColSize( 1, m_modelsGrid->GetVisibleWidth( 1, true, false, false ) );
Layout();
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
@ -440,185 +377,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
}
void DIALOG_FOOTPRINT_PROPERTIES::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, 0 );
}
m_previewPane->SetSelectedModel( aModelIdx );
m_inSelect = false;
}
void DIALOG_FOOTPRINT_PROPERTIES::On3DModelSelected( wxGridEvent& aEvent )
{
if( !m_inSelect )
select3DModel( aEvent.GetRow() );
}
void DIALOG_FOOTPRINT_PROPERTIES::On3DModelCellChanged( wxGridEvent& aEvent )
{
if( aEvent.GetCol() == 0 )
{
bool hasAlias = false;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
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();
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(), 0, filename );
}
else if( aEvent.GetCol() == 1 )
{
wxString showValue = m_modelsGrid->GetCellValue( aEvent.GetRow(), 1 );
m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT( "1" ) );
}
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES::OnRemove3DModel( wxCommandEvent& )
{
m_modelsGrid->CommitPendingChanges( true /* quiet mode */ );
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, 1 );
select3DModel( idx ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
}
}
void DIALOG_FOOTPRINT_PROPERTIES::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, 0, filename );
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
select3DModel( idx );
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES::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, 1, wxT( "1" ) );
select3DModel( row );
m_modelsGrid->SetFocus();
m_modelsGrid->MakeCellVisible( row, 0 );
m_modelsGrid->SetGridCursor( row, 0 );
m_modelsGrid->EnableCellEditControl( true );
m_modelsGrid->ShowCellEditControl();
}
bool DIALOG_FOOTPRINT_PROPERTIES::Validate()
{
if( !m_itemsGrid->CommitPendingChanges() )
@ -661,7 +419,9 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
if( !m_itemsGrid->CommitPendingChanges() )
return false;
if( !m_modelsGrid->CommitPendingChanges() )
// This only commits the editor, model updating is done below so it is inside
// the commit
if( !m_3dPanel->TransferDataFromWindow() )
return false;
auto view = m_frame->GetCanvas()->GetView();
@ -774,9 +534,11 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
if( change_layer )
m_footprint->Flip( m_footprint->GetPosition(), m_frame->Settings().m_FlipLeftRight );
std::list<FP_3DMODEL>* draw3D = &m_footprint->Models();
draw3D->clear();
draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
// Copy the models from the panel to the footprint
std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
std::list<FP_3DMODEL>* fpList = &m_footprint->Models();
fpList->clear();
fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
// This is a simple edit, we must create an undo entry
if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
@ -850,18 +612,10 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnDeleteField( wxCommandEvent& )
}
void DIALOG_FOOTPRINT_PROPERTIES::Cfg3DPath( wxCommandEvent& )
{
if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
m_previewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns( int aWidth )
{
// Account for scroll bars
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();
@ -874,13 +628,14 @@ void DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns( int aWidth )
m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
}
m_modelsGrid->SetColSize( 0, modelsWidth - m_modelsGrid->GetColSize( 1 ) - 6 );
// Update the width of the 3D panel
m_3dPanel->AdjustGridColumnWidths( aWidth );
}
void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
{
if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
if( !m_itemsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
// Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
@ -930,8 +685,6 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
}
m_initialFocus = false;
}
m_buttonRemove->Enable( m_modelsGrid->GetNumberRows() > 0 );
}

View File

@ -35,8 +35,7 @@
class PCB_EDIT_FRAME;
class PANEL_PREVIEW_3D_MODEL;
class PANEL_FP_PROPERTIES_3D_MODEL;
class DIALOG_FOOTPRINT_PROPERTIES: public DIALOG_FOOTPRINT_PROPERTIES_BASE
{
@ -65,18 +64,12 @@ public:
private:
// virtual event functions
void On3DModelSelected( wxGridEvent& ) override;
void On3DModelCellChanged( wxGridEvent& aEvent ) override;
void OnRemove3DModel( wxCommandEvent& ) override;
void OnAdd3DModel( wxCommandEvent& ) override;
void OnAdd3DRow( wxCommandEvent& ) override;
void EditFootprint( wxCommandEvent& ) override;
void EditLibraryFootprint( wxCommandEvent& ) override;
void UpdateFootprint( wxCommandEvent& ) override;
void ChangeFootprint( wxCommandEvent& ) override;
void FootprintOrientEvent( wxCommandEvent& ) override;
void OnOtherOrientation( wxCommandEvent& aEvent ) override;
void Cfg3DPath( wxCommandEvent& ) override;
void OnGridSize( wxSizeEvent& aEvent ) override;
void OnAddField( wxCommandEvent& ) override;
void OnDeleteField( wxCommandEvent& ) override;
@ -109,18 +102,16 @@ private:
UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste;
std::vector<FP_3DMODEL> m_shapes3D_list;
PANEL_PREVIEW_3D_MODEL* m_previewPane;
wxString m_delayedErrorMessage;
wxGrid* m_delayedFocusGrid;
int m_delayedFocusRow;
int m_delayedFocusColumn;
bool m_initialFocus;
bool m_inSelect;
std::vector<bool> m_macHack;
enum FP_PROPS_RETVALUE m_returnValue; // the option that closed the dialog
PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel;
};

View File

@ -431,81 +431,6 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_PanelClearances->Layout();
bSizerPanelClearances->Fit( m_PanelClearances );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), true );
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, 0 );
// Grid
m_modelsGrid->CreateGrid( 3, 2 );
m_modelsGrid->EnableEditing( true );
m_modelsGrid->EnableGridLines( true );
m_modelsGrid->EnableDragGridSize( false );
m_modelsGrid->SetMargins( 0, 0 );
// Columns
m_modelsGrid->SetColSize( 0, 650 );
m_modelsGrid->SetColSize( 1, 65 );
m_modelsGrid->EnableDragColMove( false );
m_modelsGrid->EnableDragColSize( false );
m_modelsGrid->SetColLabelSize( 24 );
m_modelsGrid->SetColLabelValue( 0, _("3D Model(s)") );
m_modelsGrid->SetColLabelValue( 1, _("Show") );
m_modelsGrid->SetColLabelAlignment( wxALIGN_CENTER, 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 );
m_modelsGrid->SetMinSize( wxSize( -1,56 ) );
sbSizer3->Add( m_modelsGrid, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
m_buttonAdd = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_buttonAdd, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_buttonBrowse = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizer3DButtons->Add( 20, 0, 0, wxEXPAND, 5 );
m_buttonRemove = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonCfgPath = new wxButton( sbSizer3->GetStaticBox(), wxID_ANY, _("Configure Paths..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonCfgPath, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 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 );
@ -570,12 +495,6 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::Cfg3DPath ), NULL, this );
}
DIALOG_FOOTPRINT_PROPERTIES_BASE::~DIALOG_FOOTPRINT_PROPERTIES_BASE()
@ -597,11 +516,5 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::~DIALOG_FOOTPRINT_PROPERTIES_BASE()
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::Cfg3DPath ), NULL, this );
}

View File

@ -3795,507 +3795,6 @@
</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="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" 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="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_CENTER</property>
<property name="col_label_size">24</property>
<property name="col_label_values">&quot;3D Model(s)&quot; &quot;Show&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">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">1</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">-1,56</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"></property>
<event name="OnGridCmdCellChange">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="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" 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">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">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_buttonAdd</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="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" 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">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">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_buttonBrowse</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="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" 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">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">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_buttonRemove</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="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<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">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</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_buttonCfgPath</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 class="sizeritem" expanded="1">

View File

@ -109,14 +109,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextInfoPaste;
wxStaticText* m_staticText16;
wxChoice* m_ZoneConnectionChoice;
wxPanel* m_Panel3D;
wxBoxSizer* bSizerMain3D;
WX_GRID* m_modelsGrid;
wxBitmapButton* m_buttonAdd;
wxBitmapButton* m_buttonBrowse;
wxBitmapButton* m_buttonRemove;
wxButton* m_buttonCfgPath;
wxBoxSizer* bLowerSizer3D;
wxStaticText* m_libraryIDLabel;
wxTextCtrl* m_tcLibraryID;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
@ -136,12 +128,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
virtual void ChangeFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditLibraryFootprint( 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:

View File

@ -93,7 +93,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_itemsGrid->SetTable( m_texts );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
// Show/hide columns according to the user's preference
m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns );
@ -126,14 +125,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
{
SetInitialFocus( m_NetClearanceCtrl );
}
/* else
{
m_delayedFocusGrid = m_modelsGrid;
m_delayedFocusRow = 0;
m_delayedFocusColumn = 0;
m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_3D_MODELS;
}
*/
m_sdbSizerStdButtonsOK->SetDefault();
@ -188,11 +179,11 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
if( !m_PanelGeneral->TransferDataToWindow() )
return false;
// Add the models to the panel
if( !m_3dPanel->TransferDataToWindow() )
return false;
// Module Texts
// Footprint Texts
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
@ -204,7 +195,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
m_texts->push_back( *textItem );
}
// notify the grid
// Notify the grid
wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
m_itemsGrid->ProcessTableMessage( tmsg );
@ -247,23 +238,12 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
switch( m_footprint->GetZoneConnection() )
{
default:
case ZONE_CONNECTION::INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
break;
case ZONE_CONNECTION::FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case ZONE_CONNECTION::THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
}
// 3D Settings
m_3dPanel->ReloadModelsFromFootprint();
// Items grid
for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
{
@ -374,7 +354,8 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
if( !m_itemsGrid->CommitPendingChanges() )
return false;
// This only commits the editor, model updating is done below
// This only commits the editor, model updating is done below so it is inside
// the commit
if( !m_3dPanel->TransferDataFromWindow() )
return false;
@ -555,7 +536,9 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnDeleteField( wxCommandEvent& event
int curRow = m_itemsGrid->GetGridCursorRow();
if( curRow < 0 )
{
return;
}
else if( curRow < 2 )
{
DisplayError( nullptr, _( "Reference and value are mandatory." ) );
@ -602,11 +585,6 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
if( !m_itemsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth() );
if( m_itemsGrid->IsCellEditControlShown() )
{
// Currently: nothing to do
}
// Handle a delayed focus. The delay allows us to:
// a) change focus when the error was triggered from within a killFocus handler
// b) show the correct notebook page in the background before the error dialog comes up

View File

@ -52,7 +52,7 @@ enum MODELS_TABLE_COLUMNS
};
PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(
FOOTPRINT_EDIT_FRAME* aFrame, FOOTPRINT* aFootprint, DIALOG_SHIM* aDialogParent,
PCB_BASE_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 ),
@ -119,6 +119,12 @@ PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL()
}
bool PANEL_FP_PROPERTIES_3D_MODEL::TransferDataToWindow()
{
ReloadModelsFromFootprint();
return true;
}
bool PANEL_FP_PROPERTIES_3D_MODEL::TransferDataFromWindow()
{
// Only commit changes in the editor, not the models
@ -163,9 +169,9 @@ void PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint()
updateValidateStatus( row );
}
select3DModel( 0 ); // will clamp idx within bounds
m_previewPane->UpdateDummyFootprint();
select3DModel( 0 );
m_previewPane->UpdateDummyFootprint();
m_modelsGrid->SetColSize( COL_SHOWN, m_modelsGrid->GetVisibleWidth( COL_SHOWN, true, false, false ) );
Layout();
@ -210,6 +216,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged( wxGridEvent& aEvent )
filename.Replace( "\r", "" );
filename.Replace( "\t", "" );
// The user is warned about failed validation through the updateValidateStatus call below
if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
aEvent.Veto();

View File

@ -30,8 +30,8 @@
#include <vector>
class DIALOG_SHIM;
class FOOTPRINT_EDIT_FRAME;
class PANEL_PREVIEW_3D_MODEL;
class PCB_BASE_EDIT_FRAME;
enum class MODEL_VALIDATE_ERRORS
{
@ -45,7 +45,7 @@ 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,
PANEL_FP_PROPERTIES_3D_MODEL( PCB_BASE_EDIT_FRAME* aFrame, FOOTPRINT* aFootprint,
DIALOG_SHIM* aDialogParent, wxWindow* aParent,
wxWindowID aId = wxID_ANY,
const wxPoint& aPos = wxDefaultPosition,
@ -55,6 +55,7 @@ public:
~PANEL_FP_PROPERTIES_3D_MODEL() override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ReloadModelsFromFootprint();
@ -85,7 +86,7 @@ private:
private:
DIALOG_SHIM* m_parentDialog;
FOOTPRINT_EDIT_FRAME* m_frame;
PCB_BASE_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint;
std::vector<FP_3DMODEL> m_shapes3D_list;