57 wxWindow* aParent, wxWindowID aId,
const wxPoint& aPos,
const wxSize& aSize,
long aStyle,
58 const wxString& aName ) :
60 m_parentDialog( aDialogParent ),
62 m_footprint( aFootprint ),
79 wxGridCellAttr* attr =
new wxGridCellAttr;
84 attr =
new wxGridCellAttr;
90 attr =
new wxGridCellAttr;
91 attr->SetRenderer(
new wxGridCellBoolRenderer() );
93 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
97 m_frame->
Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &
Pgm() );
117 m_frame->
Prj().Get3DCacheManager()->FlushCache(
false );
143 wxString default_path;
147 default_path.Replace( wxT(
"/" ), wxT(
"\\" ) );
153 wxString origPath, alias, shortPath;
159 origPath = model.m_Filename;
161 if( res && res->
SplitAlias( origPath, alias, shortPath ) )
162 origPath = alias + wxT(
":" ) + shortPath;
186 aModelIdx = std::max( 0, aModelIdx );
187 aModelIdx = std::min( aModelIdx,
m_modelsGrid->GetNumberRows() - 1 );
212 bool hasAlias =
false;
217 if( !filename.empty() )
219 filename.Replace( wxT(
"\n" ), wxEmptyString );
220 filename.Replace( wxT(
"\r" ), wxEmptyString );
221 filename.Replace( wxT(
"\t" ), wxEmptyString );
227 filename.insert( 0, wxT(
":" ) );
231 filename.Replace( wxT(
"\\" ), wxT(
"/" ) );
248 m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT(
"1" ) );
289 if( initialpath.IsEmpty() )
291 if( !wxGetEnv( wxT(
"KICAD6_3DMODEL_DIR" ), &initialpath ) || initialpath.IsEmpty() )
300 if( tmp > 0 && tmp <= INT_MAX )
320 if( res && res->
SplitAlias( filename, alias, shortPath ) )
321 filename = alias + wxT(
":" ) + shortPath;
325 model.
m_Filename.Replace( wxT(
"\\" ), wxT(
"/" ) );
384 icon = wxICON_WARNING;
385 errStr =
_(
"No filename entered" );
390 errStr =
_(
"Illegal filename" );
395 errStr =
_(
"File not found" );
400 errStr =
_(
"Unable to open file" );
405 errStr =
_(
"Unknown error" );
417 if( aFilename.empty() )
420 bool hasAlias =
false;
429 wxString fullPath = resolv->
ResolvePath( aFilename );
431 if( fullPath.IsEmpty() )
434 if( !wxFileName::IsFileReadable( fullPath ) )
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
void On3DModelSelected(wxGridEvent &) override
void AdjustGridColumnWidths(int aWidth)
Container for project specific data.
void OnUpdateUI(wxUpdateUIEvent &event) override
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
This file is part of the common library.
void ReloadModelsFromFootprint()
~PANEL_FP_PROPERTIES_3D_MODEL() override
void SetReadOnly(bool aReadOnly)
DIALOG_SHIM * m_parentDialog
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath) const
Return true if the given name contains an alias and populates the string anAlias with the alias and a...
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, FP_3DMODEL *aModel)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
MODEL_VALIDATE_ERRORS validateModelExists(const wxString &aFilename)
std::vector< FP_3DMODEL > m_shapes3D_list
wxBitmapButton * m_button3DShapeRemove
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
void OnAdd3DModel(wxCommandEvent &event) override
void On3DModelCellChanged(wxGridEvent &aEvent) override
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
virtual const wxString GetProjectPath() const
Return the full path of the project.
wxBitmapButton * m_button3DShapeAdd
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
bool ValidateFileName(const wxString &aFileName, bool &hasAlias) const
Returns true if the given path is a valid aliased relative path.
void updateValidateStatus(int aRow)
wxBoxSizer * bLowerSizer3D
void OnAdd3DRow(wxCommandEvent &event) override
wxString m_lastFootprint3dDir
bool m_Show
Include model in rendering.
void OnRemove3DModel(wxCommandEvent &event) override
PANEL_PREVIEW_3D_MODEL * m_previewPane
wxBitmapButton * m_button3DShapeBrowse
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
#define KICAD6_3DMODEL_DIR
A variable name whose value holds the path of 3D shape files.
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
void Cfg3DPath(wxCommandEvent &event) override
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
wxString ResolvePath(const wxString &aFileName)
Determines the full path of the given file name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString m_Filename
The 3D shape filename in 3D library.
PCB_BASE_EDIT_FRAME * m_frame
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool Configure3DPaths(wxWindow *aParent, FILENAME_RESOLVER *aResolver)
Provide an extensible class to resolve 3D model paths.
Common, abstract interface for edit frames.
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Class PANEL_FP_PROPERTIES_3D_MODEL_BASE.
bool TransferDataToWindow() override
void select3DModel(int aModelIdx)
void SetTooltipEnable(int aCol, bool aEnable=true)
Enable the tooltip for a column.
bool TransferDataFromWindow() override
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, const wxSize &aSize=wxDefaultSize, long aStyle=wxTAB_TRAVERSAL, const wxString &aName=wxEmptyString)