31#include <wx/textfile.h>
32#include <wx/filename.h>
55 wxTreeCtrl* parent ) :
71 if( state < 0 || state >=
m_parent->GetImageCount() / ( treeEnumMax - 2 ) )
75 int imgid =
static_cast<int>(
m_type ) - 1 + state * ( treeEnumMax - 1 );
76 m_parent->SetItemImage( GetId(), imgid );
77 m_parent->SetItemImage( GetId(), imgid, wxTreeItemIcon_Selected );
119 const wxString sep = wxFileName().GetPathSeparator();
124 newFile = dirs + sep +
name;
133 wxString full_ext = wxT(
"." ) + ext;
135 if( check && !ext.IsEmpty() && !newFile.Lower().EndsWith( full_ext ) )
138 "Do you want to continue ?" ),
139 _(
"Rename File" ), wxYES_NO | wxICON_QUESTION );
141 if( wxID_YES != dialog.ShowModal() )
145 if( !wxRenameFile(
GetFileName(), newFile,
false ) )
148 wxICON_ERROR | wxOK );
166 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to recycle bin."),
169 wxString dialogMsg = wxString::Format(
_(
"Can not move '%s' to trash."),
192 std::set<wxString>& aSheetFiles )
194 if( aSheetFiles.count( aRootSchematic ) )
197 aSheetFiles.insert( aRootSchematic );
201 if( !file.Open( aRootSchematic ) )
204 wxFileName rootFn( aRootSchematic );
205 wxString rootDir = rootFn.GetPath();
208 wxRegEx sheetfileRe(
"\\(property\\s+\"Sheetfile\"\\s+\"([^\"]+)\"" );
210 for( wxString line = file.GetFirstLine(); !file.Eof(); line = file.GetNextLine() )
212 if( sheetfileRe.Matches( line ) )
214 wxString sheetFile = sheetfileRe.GetMatch( line, 1 );
217 wxFileName sheetFn( sheetFile );
219 if( !sheetFn.IsAbsolute() )
220 sheetFn.MakeAbsolute( rootDir );
222 wxString fullPath = sheetFn.GetFullPath();
224 if( wxFileExists( fullPath ) )
234 wxTreeItemId
id = GetId();
265 if( rootSchematic.IsEmpty() )
268 if( fullFileName == rootSchematic )
275 std::set<wxString> hierarchyFiles;
277 if( !rootSchematic.IsEmpty() && wxFileExists( rootSchematic ) )
280 bool isInHierarchy = hierarchyFiles.count( fullFileName ) > 0;
296 packet = fullFileName.ToStdString();
329 wxLaunchDefaultBrowser( fullFileName );
349 packet = fullFileName.ToStdString();
356 packet = fullFileName.ToStdString();
361 wxLaunchDefaultApplication( fullFileName );
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 OpenJobsFile(const wxFileName &aFileName, bool aCreate=false, bool aResaveProjectPreferences=true)
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 wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
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.
#define KICAD_MESSAGE_DIALOG
@ FRAME_SCH_SYMBOL_EDITOR
bool OpenPDF(const wxString &file)
Run the PDF viewer and display a PDF file.
@ MAIL_SCH_NAVIGATE_TO_SHEET
static void ScanSchematicHierarchy(const wxString &aRootSchematic, std::set< wxString > &aSheetFiles)
Scan a schematic file hierarchy to collect all sheet file paths.