KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gestfich.h File Reference
#include <kicommon.h>
#include <wx/filename.h>
#include <wx/process.h>

Go to the source code of this file.

Macros

#define UNIX_STRING_DIR_SEP   wxT( "/" )
 
#define WIN_STRING_DIR_SEP   wxT( "\\" )
 

Functions

KICOMMON_API bool OpenPDF (const wxString &file)
 Run the PDF viewer and display a PDF file.
 
KICOMMON_API void OpenFile (const wxString &file)
 
KICOMMON_API void KiCopyFile (const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
 
KICOMMON_API int ExecuteFile (const wxString &aEditorName, const wxString &aFileName=wxEmptyString, wxProcess *aCallback=nullptr, bool aFileForKicad=true)
 Call the executable file aEditorName with the parameter aFileName.
 
KICOMMON_API void QuoteString (wxString &string)
 Add un " to the start and the end of string (if not already done).
 
KICOMMON_API wxString FindKicadFile (const wxString &shortname)
 Search the executable file shortname in KiCad binary path and return full file name if found or shortname if the kicad binary path is kicad/bin.
 
KICOMMON_API wxString QuoteFullPath (wxFileName &fn, wxPathFormat format=wxPATH_NATIVE)
 Quote return value of wxFileName::GetFullPath().
 
KICOMMON_API bool RmDirRecursive (const wxString &aDirName, wxString *aErrors=nullptr)
 Removes the directory aDirName and all its contents including subdirectories and their files.
 

Macro Definition Documentation

◆ UNIX_STRING_DIR_SEP

#define UNIX_STRING_DIR_SEP   wxT( "/" )
Note
Do we really need these defined?

Definition at line 36 of file gestfich.h.

◆ WIN_STRING_DIR_SEP

#define WIN_STRING_DIR_SEP   wxT( "\\" )

Definition at line 37 of file gestfich.h.

Function Documentation

◆ ExecuteFile()

KICOMMON_API int ExecuteFile ( const wxString &  aEditorName,
const wxString &  aFileName = wxEmptyString,
wxProcess *  aCallback = nullptr,
bool  aFileForKicad = true 
)

Call the executable file aEditorName with the parameter aFileName.

Parameters
aEditorNameis the full filename for the binary.
aFileNameis the full filename of the file to open.
aCallbacka wxProcess* for the call.
aFileForKicada boolean to flag if aFileName runs with a KiCad binary. In this case aFileName is a shortname and FindKicadFile() is called to return the path. In the other case, aFileName is a full file name (passed prefixed with the path).

Definition at line 139 of file gestfich.cpp.

References _, DisplayError(), and FindKicadFile().

Referenced by KICAD_MANAGER_CONTROL::Execute(), DIALOG_CONFIG_EQUFILES::OnEditEquFile(), DIALOG_BOM::OnEditGenerator(), SCH_EDIT_FRAME::OnOpenPcbnew(), PROJECT_TREE_PANE::onOpenSelectedFileWithTextEditor(), SYMBOL_EDITOR_CONTROL::OpenWithTextEditor(), FOOTPRINT_EDITOR_CONTROL::OpenWithTextEditor(), PCB_EDIT_FRAME::RunEeschema(), and GERBVIEW_INSPECTION_TOOL::ShowSource().

◆ FindKicadFile()

KICOMMON_API wxString FindKicadFile ( const wxString &  shortname)

Search the executable file shortname in KiCad binary path and return full file name if found or shortname if the kicad binary path is kicad/bin.

The binary path is found from:

  • binary path.
  • KICAD environment variable.
  • c:\kicad or /usr/local/kicad (the default).
  • default binary path.

Definition at line 54 of file gestfich.cpp.

References arrayDim(), PGM_BASE::GetExecutablePath(), PGM_BASE::GetKicadEnvVariable(), and Pgm().

Referenced by KICAD_MANAGER_FRAME::DoWithAcceptedFiles(), and ExecuteFile().

◆ KiCopyFile()

KICOMMON_API void KiCopyFile ( const wxString &  aSrcPath,
const wxString &  aDestPath,
wxString &  aErrors 
)
Parameters
aSrcPathis the full filename of the source.
aDestPathis the full filename of the target
aErrorsa wxString to append any errors to

Definition at line 305 of file gestfich.cpp.

References _.

Referenced by MIGRATION_TRAVERSER::OnFile(), SAVE_AS_TRAVERSER::OnFile(), SCH::IFACE::SaveFileAs(), GERBV::IFACE::SaveFileAs(), PGE::IFACE::SaveFileAs(), PCB::IFACE::SaveFileAs(), PCB_EDIT_FRAME::SavePcbCopy(), and PCB_EDIT_FRAME::SavePcbFile().

◆ OpenFile()

KICOMMON_API void OpenFile ( const wxString &  file)

Definition at line 286 of file gestfich.cpp.

Referenced by PROJECT_TREE_ITEM::Activate().

◆ OpenPDF()

KICOMMON_API bool OpenPDF ( const wxString &  file)

Run the PDF viewer and display a PDF file.

Parameters
filethe PDF file to open.
Returns
true is success or false if no PDF viewer found.

Definition at line 250 of file gestfich.cpp.

References _, DisplayError(), PGM_BASE::GetPdfBrowserName(), LaunchExternal(), Pgm(), and PGM_BASE::ReadPdfBrowserInfos().

Referenced by PROJECT_TREE_ITEM::Activate(), and GetAssociatedDocument().

◆ QuoteFullPath()

KICOMMON_API wxString QuoteFullPath ( wxFileName &  fn,
wxPathFormat  format = wxPATH_NATIVE 
)

Quote return value of wxFileName::GetFullPath().

This allows file name paths with spaces to be used as parameters to ProcessExecute function calls.

Parameters
fnis the filename to wrap.
formatif provided, can be used to transform the nature of the wrapped filename to another platform.

Definition at line 320 of file gestfich.cpp.

◆ QuoteString()

KICOMMON_API void QuoteString ( wxString &  string)

Add un " to the start and the end of string (if not already done).

Parameters
stringstring to modify.

Definition at line 44 of file gestfich.cpp.

◆ RmDirRecursive()

KICOMMON_API bool RmDirRecursive ( const wxString &  aDirName,
wxString *  aErrors = nullptr 
)

Removes the directory aDirName and all its contents including subdirectories and their files.

Definition at line 326 of file gestfich.cpp.

References _, and path.

Referenced by PROJECT_TREE_PANE::onGitRemoveVCS(), and DIALOG_GIT_REPOSITORY::~DIALOG_GIT_REPOSITORY().