KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PROJECT_TEMPLATE Class Reference

A class which provides project template functionality. More...

#include <project_template.h>

Public Member Functions

 PROJECT_TEMPLATE (const wxString &aPath)
 Create a new project instance from aPath. More...
 
 ~PROJECT_TEMPLATE ()
 Non-virtual destructor (so no derived classes) More...
 
wxString GetPrjDirName ()
 Get the dir name of the project template (i.e. More...
 
wxFileName GetHtmlFile ()
 Get the full Html filename for the project template. More...
 
bool CreateProject (wxFileName &aNewProjectPath, wxString *aErrorMsg=nullptr)
 Copies and renames all template files to create a new project. More...
 
wxBitmap * GetIcon ()
 Get the 64px^2 icon for the project template. More...
 
wxString * GetTitle ()
 Get the title of the project (extracted from the html title tag) More...
 
std::vector< wxFileName > GetFileList ()
 Get a vector list of filenames for the template. More...
 
size_t GetDestinationFiles (const wxFileName &aNewProjectPath, std::vector< wxFileName > &aDestFiles)
 Fetch the list of destination files to be copied when the new project is created. More...
 

Protected Attributes

wxFileName m_basePath
 
wxFileName m_metaPath
 
wxFileName m_metaHtmlFile
 
wxFileName m_metaIconFile
 
wxBitmap * m_metaIcon
 
wxString m_title
 

Detailed Description

A class which provides project template functionality.

Definition at line 143 of file project_template.h.

Constructor & Destructor Documentation

◆ PROJECT_TEMPLATE()

PROJECT_TEMPLATE::PROJECT_TEMPLATE ( const wxString &  aPath)

Create a new project instance from aPath.

aPath should be a directory that conforms to the project template requirements

Parameters
aPathShould be a directory containing the template

Definition at line 39 of file project_template.cpp.

References _, m_basePath, m_metaHtmlFile, m_metaIcon, m_metaIconFile, m_metaPath, m_title, METADIR, METAFILE_ICON, METAFILE_INFO_HTML, and SEP.

◆ ~PROJECT_TEMPLATE()

PROJECT_TEMPLATE::~PROJECT_TEMPLATE ( )

Non-virtual destructor (so no derived classes)

Definition at line 148 of file project_template.cpp.

Member Function Documentation

◆ CreateProject()

bool PROJECT_TEMPLATE::CreateProject ( wxFileName &  aNewProjectPath,
wxString *  aErrorMsg = nullptr 
)

Copies and renames all template files to create a new project.

Parameters
aNewProjectPathThe full path of the new project file to create
aErrorMsgis an optional string to place project creation error messages.
Returns
true if the project creation was successful otherwise false.

Definition at line 212 of file project_template.cpp.

References _, FILEEXT::DrawingSheetFileExtension, GetFileList(), GetPrjDirName(), FILEEXT::LegacyProjectFileExtension, m_basePath, and FILEEXT::ProjectFileExtension.

Referenced by KICAD_MANAGER_CONTROL::NewFromTemplate().

◆ GetDestinationFiles()

size_t PROJECT_TEMPLATE::GetDestinationFiles ( const wxFileName &  aNewProjectPath,
std::vector< wxFileName > &  aDestFiles 
)

Fetch the list of destination files to be copied when the new project is created.

Parameters
aNewProjectPathis the path to the project to be created.
aDestFilesis a container to place the list of destination files to be created.
Returns
the number of destination files added to the container.

Definition at line 166 of file project_template.cpp.

References GetFileList(), GetPrjDirName(), FILEEXT::LegacyProjectFileExtension, m_basePath, name, path, and FILEEXT::ProjectFileExtension.

Referenced by KICAD_MANAGER_CONTROL::NewFromTemplate().

◆ GetFileList()

std::vector< wxFileName > PROJECT_TEMPLATE::GetFileList ( )

Get a vector list of filenames for the template.

The files are the source files, and have not yet been through any renaming

Definition at line 131 of file project_template.cpp.

References m_basePath, and m_metaPath.

Referenced by CreateProject(), and GetDestinationFiles().

◆ GetHtmlFile()

wxFileName PROJECT_TEMPLATE::GetHtmlFile ( )

Get the full Html filename for the project template.

Returns
the html meta information file for this template

Definition at line 154 of file project_template.cpp.

References m_metaHtmlFile.

Referenced by GetTitle(), and DIALOG_TEMPLATE_SELECTOR::SetWidget().

◆ GetIcon()

wxBitmap * PROJECT_TEMPLATE::GetIcon ( )

Get the 64px^2 icon for the project template.

Returns
an image file of 64px x 64px which is the templates icon

Definition at line 160 of file project_template.cpp.

References m_metaIcon.

Referenced by TEMPLATE_WIDGET::SetTemplate().

◆ GetPrjDirName()

wxString PROJECT_TEMPLATE::GetPrjDirName ( )

Get the dir name of the project template (i.e.

the name of the last folder containing the template files)

Returns
the dir name of the template

Definition at line 142 of file project_template.cpp.

References m_basePath.

Referenced by CreateProject(), and GetDestinationFiles().

◆ GetTitle()

wxString * PROJECT_TEMPLATE::GetTitle ( )

Get the title of the project (extracted from the html title tag)

Definition at line 320 of file project_template.cpp.

References GetHtmlFile(), m_title, and text.

Referenced by TEMPLATE_WIDGET::SetTemplate().

Member Data Documentation

◆ m_basePath

wxFileName PROJECT_TEMPLATE::m_basePath
protected

◆ m_metaHtmlFile

wxFileName PROJECT_TEMPLATE::m_metaHtmlFile
protected

Definition at line 148 of file project_template.h.

Referenced by GetHtmlFile(), and PROJECT_TEMPLATE().

◆ m_metaIcon

wxBitmap* PROJECT_TEMPLATE::m_metaIcon
protected

Definition at line 150 of file project_template.h.

Referenced by GetIcon(), and PROJECT_TEMPLATE().

◆ m_metaIconFile

wxFileName PROJECT_TEMPLATE::m_metaIconFile
protected

Definition at line 149 of file project_template.h.

Referenced by PROJECT_TEMPLATE().

◆ m_metaPath

wxFileName PROJECT_TEMPLATE::m_metaPath
protected

Definition at line 147 of file project_template.h.

Referenced by GetFileList(), and PROJECT_TEMPLATE().

◆ m_title

wxString PROJECT_TEMPLATE::m_title
protected

Definition at line 151 of file project_template.h.

Referenced by GetTitle(), and PROJECT_TEMPLATE().


The documentation for this class was generated from the following files: