KiCad PCB EDA Suite
|
Author: Brian Sidebotham.
To add new project template functionality to KiCad to facilitate the easy setup of projects which have common attributes such as pre-defined board outlines, connector positions, schematic elements, design rules, etc.
A template is a directory of files, which includes a directory of metadata. The template system name (SYSNAME) is the directory name under which the template files are stored. The metadata directory (METADIR) contains pre-defined files which provide information about the template.
All files and directories in a template are copied to the new project path when a project is created using a template, except METADIR.
All files and directories which start with SYSNAME will have SYSNAME replaced by the new project file name, excluding the file extension.
A template's METADIR must contain the required files, and might optionally contain any of the optional files
Required Files ~~~~~~~~~~~~~~ /info.html - Contains html formatted information about the template which is used by the user to determine if the template is what they are after. The <title> tag determines the actual name of the template that is exposed to the user for template selection. Using html to format this document means that images can be in-lined without having to invent a new scheme. Only HTML supported by wxHTML can be used to format this document. Optional Files ~~~~~~~~~~~~~~ /icon.png - A 64 x 64px PNG icon file which is used as a clickable icon in the template selection dialog.
The KiCad File menu will be modified to change New from a menu item to a pop-out menu item, in the same manor as Open Recent. There will be two options on the pop-out menu:
Blank -> Will act exactly the same as the current new menu item so that anyone who wishes to create a blank project won't have their settings lost or feel alienated.
From Template -> Will open the template selection dialog.
The template selection dialog will have a list of icons on the left, and a wxHTML window to the right. A single click on a template's icon on the left will load that templates info.html metadata file and display it in the wxHTML window.
A double click on a template's icon will start the new project creation and will open a new file dialog. If the user selects a valid location for the new project, the template will be copied to the new project location ( excluding METADIR as mentioned earlier ) and any files that match the string replacement rules will be renamed to reflect the new project's name.
The list of available templates will be gathered from the following sources:
wxStandardPaths::GetExecutableDir()/../share/template/ wxStandardPaths::GetUserDataDir()/templates/ wxGetEnv(wxT("KICAD_PTEMPLATES")) wxGetEnv(wxT("KICAD"))/template/