kicad-source/kicad/import_proj.h
lulu731 0180bcf90a ADDED: Implement Drag and Drop
dropping files to Kicad manager :
  *.kicad_pro, *.pro -> open project;
  gerber and job files -> open in Gerbview editor;
  Eagle and Cadstar files -> open project.
dropping file to schematic editor -> append schematic;
dropping library file to Symbol editor -> add library;
dropping board file to PCB editor -> append board;
dropping library or footprint file to Footprint editor -> add library or import footprint;
dropping ZIP file or gerber files to Gerbview editor -> open files;
dropping sheet file to Drawing Sheet editor -> open sheet.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11638
2022-09-14 22:28:09 +00:00

56 lines
1.9 KiB
C++

#ifndef IMPORT_PROJ_H
#define IMPORT_PROJ_H
#include "kicad_manager_frame.h"
#include <wx/filename.h>
#include <core/typeinfo.h>
/**
* A helper class to import non Kicad project.
* */
class IMPORT_PROJ_HELPER
{
public:
IMPORT_PROJ_HELPER( KICAD_MANAGER_FRAME* aframe, const wxString& aFile,
const wxString& aSchFileExtension, const wxString& aPcbFileExtension );
const wxFileName& GetProj();
wxString GetProjPath();
void SetProjPath( const wxString aPath );
wxString GetProjFullPath();
wxString GetProjName();
/**
* @brief Appends a new directory with the name of the project file
* Keep iterating until an empty directory is found
*/
void CreateEmptyDirForProject();
void SetProjAbsolutePath();
/**
* @brief Copies project files to the destination directory
* @param displayError calls OutputCopyError() if true
*/
bool CopyImportedFiles( bool displayError = true );
/**
* @brief Converts imported files to kicad type files.
* Types of imported files are needed for conversion
* @param aImportedSchFileType type of the imported schematic
* @param aImportedPcbFileType type of the imported PCB
*/
void AssociateFilesWithProj( int aImportedSchFileType, int aImportedPcbFileType );
private:
KICAD_MANAGER_FRAME* m_frame;
wxFileName m_sch;
wxFileName m_shCopy;
wxFileName m_pcb;
wxFileName m_pcbCopy;
wxFileName m_pro;
bool CopyImportedFile( KICAD_T aKicad_T, bool displayError = true );
void OutputCopyError( const wxFileName& aSrc, const wxFileName& aFileCopy );
void AssociateFileWithProj( KICAD_T aKicad_T, int aImportedFileType );
};
#endif