[Lazarus] How to add your own 'New Project' template?
Michael Van Canneyt
michael.vancanneyt at wisa.be
Fri Aug 22 09:25:23 CEST 2008
On Tue, 19 Aug 2008, Tom Verhoeff wrote:
> On Mon, Aug 18, 2008 at 05:32:17PM +0200, Michael Van Canneyt wrote:
> >
> > On Mon, 18 Aug 2008, Tom Verhoeff wrote:
> >
> > > Where can one find the article? Or is this the same as the README.txt
> > > in components/projecttemplates?
> >
> > It's at home, I'll send it in private. I'm not allowed to publish
> > everything.
> >
> > The article explains how to add custom objects to the file|New dialog, and
> > uses the templates package as an example.
>
> I would appreciate receiving the article.
(article sent in private)
>
> I am working on a sample, but I am not yet satisfied with my understanding.
>
> Note that I will be using Lazarus this year in our first-year
> programming education. Others will view this as a test case for Lazarus.
>
> I have a few more questions/remarks:
>
> 1. What is the default location for the project templates?
Primary lazarus configuration dir + templates.
What exactly the primary lazarus configuration dir is, depends on the
system. For unix, this is ~/.lazarus, I don't know what it is for windows.
>
> I know the user can change it. However, in my case, the
> users are novice students. I would like to have the least hassle
> in giving them a template. So if I can avoid the need for them
> to set options, that would be preferred. I still need to see to it
> that the template gets copied to the appropriate location.
>
> 2. I have some improvements for the README.txt in components/projecttemplates/
> Can I mail a new version to you?
Please do.
>
> 3. Why are the "built-in" 'New Project' options, such as Custom Program,
> not handled via the template mechanism? An example template would
> be helpful.
Project templates were implemented WAY after the File|new mechanism :-)
>
> 4. Tools > Project template options opens a dialog window titled
> Project template settings. Naming is incosistent (options vs. settings).
If the lazarus team tells me what to change it to, I'll be glad to do so.
I was not aware of any conventions.
>
> 5. Do released (stable) builds of Lazarus always include
> the projects templates package? Version 0.9.24 does.
> That way, the user (our students) need not be bothered with
> package installation.
This is a question for the Lazarus team.
>
> 6. When creating a New Project from a template, a dialog window appears
> to set the project name and the directory name, and also to
> set additional variables.
>
> When I tried this, even though my template did not contain additional
> variables, the dialog says "This project contains additional
> variables. ...", but the list below it is empty. Is this is a bug?
> Anyway, it is confusing (especially to novices; maybe templates
> are not what I want to use after all).
The list always contains 2 variables, $(ProjName) and $(ProjDir), but
these are handled specially.
This can be improved on. Feel free to make suggestions.
> 7. It is not clear to me what the requirements are for naming files
> in the template, and how these names get changed when the template
> is instantiated. Should I put files like project.ini, project.lpi,
> project.pas, unit1.pas in the template directory, and will
> project.{lpi,pas} be renamed depending on the name chosen by
> the user when instantiating the template? That is, are there
> more substitutions than just for the occurrences of $(varname)
> in non-Exluded files, viz. file name changes?
No. Any substitution must be marked as such. There are no 'special'
cases, but if you want to send some patches to handle this, let me know.
I suggest you read the articles I sent first, it should give you a better
understanding of how it happens.
Michael.
More information about the Lazarus
mailing list