KiCad PCB EDA Suite
project_template.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
5  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
104 #ifndef PROJECT_TEMPLATE_H
105 #define PROJECT_TEMPLATE_H
106 
107 
108 #include <vector>
109 
110 #include <wx/filename.h>
111 #include <wx/intl.h>
112 
113 
114 class wxBitmap;
115 class wxFileName;
116 
122 #define METADIR wxT( "meta" )
123 
124 
130 #define METAFILE_INFO_HTML wxT( "info.html" )
131 
132 
138 #define METAFILE_ICON wxT( "icon.png" )
139 
144 {
145 protected:
146  wxFileName templateBasePath;
147  wxFileName templateMetaPath;
150  wxBitmap* metaIcon;
151  wxString title;
152 
153 public:
154 
161  PROJECT_TEMPLATE( const wxString& aPath );
162 
167 
174  wxString GetPrjDirName();
175 
181  wxFileName GetHtmlFile();
182 
190  bool CreateProject( wxFileName& aNewProjectPath, wxString* aErrorMsg = nullptr );
191 
197  wxBitmap* GetIcon();
198 
202  wxString* GetTitle();
203 
208  std::vector<wxFileName> GetFileList();
209 
217  size_t GetDestinationFiles( const wxFileName& aNewProjectPath,
218  std::vector< wxFileName >& aDestFiles );
219 };
220 
221 #endif
std::vector< wxFileName > GetFileList()
Get a vector list of filenames for the template.
wxFileName templateMetaHtmlFile
wxFileName GetHtmlFile()
Get the full Html filename for the project template.
wxFileName templateBasePath
A class which provides project template functionality.
wxFileName templateMetaIconFile
PROJECT_TEMPLATE(const wxString &aPath)
Create a new project instance from aPath.
wxString * GetTitle()
Get the title of the project (extracted from the html title tag)
wxString GetPrjDirName()
Get the dir name of the project template (i.e.
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. ...
bool CreateProject(wxFileName &aNewProjectPath, wxString *aErrorMsg=nullptr)
Copies and renames all template files to create a new project.
wxFileName templateMetaPath
~PROJECT_TEMPLATE()
Non-virtual destructor (so no derived classes)
wxBitmap * GetIcon()
Get the 64px^2 icon for the project template.