49 wxTreeCtrl* parent ) :
63 wxImageList* imglist =
m_parent->GetImageList();
64 int treeEnumMax =
static_cast<int>( TREE_FILE_TYPE::MAX );
66 if( !imglist || state < 0 || state >= imglist->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;
127 wxRegEx reg( wxT(
"^.*\\" ) + ext + wxT(
"$" ), wxRE_ICASE );
129 if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
131 wxMessageDialog dialog(
m_parent,
_(
"Changing file extension will change file type.\n"
132 "Do you want to continue ?" ),
133 _(
"Rename File" ), wxYES_NO | wxICON_QUESTION );
135 if( wxID_YES != dialog.ShowModal() )
139 if( !wxRenameFile(
GetFileName(), newFile,
false ) )
141 wxMessageDialog(
m_parent,
_(
"Unable to rename file ... " ),
_(
"Permission error?" ),
142 wxICON_ERROR | wxOK );
160 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to recycle bin."),
163 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to trash."),
178 wxTreeItemId
id = GetId();
187 case TREE_FILE_TYPE::LEGACY_PROJECT:
188 case TREE_FILE_TYPE::JSON_PROJECT:
195 case TREE_FILE_TYPE::DIRECTORY:
199 case TREE_FILE_TYPE::LEGACY_SCHEMATIC:
200 case TREE_FILE_TYPE::SEXPR_SCHEMATIC:
209 case TREE_FILE_TYPE::LEGACY_PCB:
210 case TREE_FILE_TYPE::SEXPR_PCB:
219 case TREE_FILE_TYPE::GERBER:
220 case TREE_FILE_TYPE::GERBER_JOB_FILE:
221 case TREE_FILE_TYPE::DRILL:
222 case TREE_FILE_TYPE::DRILL_NC:
223 case TREE_FILE_TYPE::DRILL_XNC:
227 case TREE_FILE_TYPE::HTML:
228 wxLaunchDefaultBrowser( fullFileName );
231 case TREE_FILE_TYPE::PDF:
235 case TREE_FILE_TYPE::NET:
236 case TREE_FILE_TYPE::TXT:
237 case TREE_FILE_TYPE::MD:
238 case TREE_FILE_TYPE::REPORT:
242 case TREE_FILE_TYPE::DRAWING_SHEET:
246 case TREE_FILE_TYPE::FOOTPRINT_FILE:
248 packet = fullFileName.ToStdString();
252 case TREE_FILE_TYPE::SCHEMATIC_LIBFILE:
253 case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE:
255 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()
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.