KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright The 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, see <https://www.gnu.org/licenses/>.
19 */
20
99
100#ifndef PROJECT_TEMPLATE_H
101#define PROJECT_TEMPLATE_H
102
103
104#include <vector>
105
106#include <wx/filename.h>
107#include <wx/intl.h>
108
109
110class wxBitmap;
111class wxFileName;
112
118#define METADIR wxT( "meta" )
119
120
126#define METAFILE_INFO_HTML wxT( "info.html" )
127
128
134#define METAFILE_ICON wxT( "icon.png" )
135
140{
141protected:
142 wxFileName m_basePath;
143 wxFileName m_metaPath;
144 wxFileName m_metaHtmlFile;
145 wxFileName m_metaIconFile;
146 wxBitmap* m_metaIcon;
147 wxString m_title;
148 wxString m_error;
149
150public:
151
158 PROJECT_TEMPLATE( const wxString& aPath );
159
164
171 wxString GetPrjDirName();
172
178 wxFileName GetHtmlFile();
179
187 bool CreateProject( wxFileName& aNewProjectPath, wxString* aErrorMsg = nullptr );
188
194 wxBitmap* GetIcon();
195
199 wxString* GetTitle();
200
201 const wxString& GetError() const { return m_error; }
202
207 std::vector<wxFileName> GetFileList();
208
216 size_t GetDestinationFiles( const wxFileName& aNewProjectPath,
217 std::vector< wxFileName >& aDestFiles );
218};
219
220
235wxFileName EnsureDefaultProjectTemplate( const wxString& aBaseDir );
236
237#endif
wxBitmap * GetIcon()
Get the 64px^2 icon for the project template.
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.
wxFileName m_metaHtmlFile
PROJECT_TEMPLATE(const wxString &aPath)
Create a new project instance from aPath.
std::vector< wxFileName > GetFileList()
Get a vector list of filenames for the template.
~PROJECT_TEMPLATE()
Non-virtual destructor (so no derived classes)
wxFileName GetHtmlFile()
Get the full Html filename for the project template.
wxString * GetTitle()
Get the title of the project (extracted from the html title tag)
bool CreateProject(wxFileName &aNewProjectPath, wxString *aErrorMsg=nullptr)
Copies and renames all template files to create a new project.
wxFileName m_metaIconFile
wxString GetPrjDirName()
Get the dir name of the project template (i.e.
const wxString & GetError() const
wxFileName EnsureDefaultProjectTemplate(const wxString &aBaseDir)
Seed the built-in "default" project template under aBaseDir, creating the directory tree and minimal ...