50 wxTreeCtrl* parent ) :
64 int treeEnumMax =
static_cast<int>( TREE_FILE_TYPE::MAX );
66 if( state < 0 || state >=
m_parent->GetImageCount() / ( treeEnumMax - 2 ) )
70 int imgid =
static_cast<int>(
m_type ) - 1 + state * ( treeEnumMax - 1 );
71 m_parent->SetItemImage( GetId(), imgid );
72 m_parent->SetItemImage( GetId(), imgid, wxTreeItemIcon_Selected );
78 if(
m_type == TREE_FILE_TYPE::DIRECTORY
79 ||
m_type == TREE_FILE_TYPE::LEGACY_PROJECT
80 ||
m_type == TREE_FILE_TYPE::JSON_PROJECT
81 ||
m_type == TREE_FILE_TYPE::LEGACY_SCHEMATIC
82 ||
m_type == TREE_FILE_TYPE::SEXPR_SCHEMATIC
83 ||
m_type == TREE_FILE_TYPE::LEGACY_PCB
84 ||
m_type == TREE_FILE_TYPE::SEXPR_PCB
85 ||
m_type == TREE_FILE_TYPE::DRAWING_SHEET
86 ||
m_type == TREE_FILE_TYPE::FOOTPRINT_FILE
87 ||
m_type == TREE_FILE_TYPE::SCHEMATIC_LIBFILE
88 ||
m_type == TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE
89 ||
m_type == TREE_FILE_TYPE::DESIGN_RULES )
98 if( TREE_FILE_TYPE::DIRECTORY ==
m_type )
114 const wxString sep = wxFileName().GetPathSeparator();
118 if( !dirs.IsEmpty() &&
GetType() != TREE_FILE_TYPE::DIRECTORY )
119 newFile = dirs + sep +
name;
128 wxString full_ext = wxT(
"." ) + ext;
130 if( check && !ext.IsEmpty() && !newFile.Lower().EndsWith( full_ext ) )
132 wxMessageDialog dialog(
m_parent,
_(
"Changing file extension will change file type.\n"
133 "Do you want to continue ?" ),
134 _(
"Rename File" ), wxYES_NO | wxICON_QUESTION );
136 if( wxID_YES != dialog.ShowModal() )
140 if( !wxRenameFile(
GetFileName(), newFile,
false ) )
142 wxMessageDialog(
m_parent,
_(
"Unable to rename file ... " ),
_(
"Permission error?" ),
143 wxICON_ERROR | wxOK );
161 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to recycle bin."),
164 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to trash."),
179 wxTreeItemId
id = GetId();
188 case TREE_FILE_TYPE::LEGACY_PROJECT:
189 case TREE_FILE_TYPE::JSON_PROJECT:
196 case TREE_FILE_TYPE::JOBSET_FILE:
201 case TREE_FILE_TYPE::DIRECTORY:
205 case TREE_FILE_TYPE::LEGACY_SCHEMATIC:
206 case TREE_FILE_TYPE::SEXPR_SCHEMATIC:
215 case TREE_FILE_TYPE::LEGACY_PCB:
216 case TREE_FILE_TYPE::SEXPR_PCB:
225 case TREE_FILE_TYPE::GERBER:
226 case TREE_FILE_TYPE::GERBER_JOB_FILE:
227 case TREE_FILE_TYPE::DRILL:
228 case TREE_FILE_TYPE::DRILL_NC:
229 case TREE_FILE_TYPE::DRILL_XNC:
233 case TREE_FILE_TYPE::HTML:
234 wxLaunchDefaultBrowser( fullFileName );
237 case TREE_FILE_TYPE::PDF:
241 case TREE_FILE_TYPE::NET:
242 case TREE_FILE_TYPE::TXT:
243 case TREE_FILE_TYPE::MD:
244 case TREE_FILE_TYPE::REPORT:
248 case TREE_FILE_TYPE::DRAWING_SHEET:
252 case TREE_FILE_TYPE::FOOTPRINT_FILE:
254 packet = fullFileName.ToStdString();
258 case TREE_FILE_TYPE::SCHEMATIC_LIBFILE:
259 case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE:
261 packet = fullFileName.ToStdString();
static TOOL_ACTION editPCB
static TOOL_ACTION editOtherPCB
static TOOL_ACTION editOtherSch
static TOOL_ACTION editSchematic
static TOOL_ACTION openTextEditor
static TOOL_ACTION editDrawingSheet
static TOOL_ACTION editFootprints
static TOOL_ACTION viewGerbers
static TOOL_ACTION editSymbols
The main KiCad project manager frame.
const wxString SchLegacyFileName()
void OpenJobsFile(const wxFileName &aFileName, bool aCreate=false)
const wxString SchFileName()
void LoadProject(const wxFileName &aProjectFileName)
const wxString PcbLegacyFileName()
const wxString PcbFileName()
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
bool CanDelete() const
Determine if a file can be deleted via the project tree pane.
void SetRootFile(bool aValue)
bool Rename(const wxString &name, bool check=true)
const wxString & GetFileName() const
void SetType(TREE_FILE_TYPE aType)
void SetPopulated(bool aValue)
TREE_FILE_TYPE GetType() const
void SetFileName(const wxString &name)
const wxString GetDir() const
void Activate(PROJECT_TREE_PANE *aTreePrjFrame)
PROJECT_TREE_PANE Window to display the tree files.
PROJECT_TREE * m_TreeProject
KICAD_MANAGER_FRAME * m_Parent
static wxString GetFileExt(TREE_FILE_TYPE type)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
@ FRAME_SCH_SYMBOL_EDITOR
bool OpenPDF(const wxString &file)
Run the PDF viewer and display a PDF file.
void OpenFile(const wxString &file)
IDs used in KiCad main frame foe menuitems and tools.