http://wiki.freepascal.org/Project_Templates
Took me some reading and experimenting but this did the trick ...

Unfortunately the documentation is rather limited.
For those who'd like to use this (please be patient with me, I'm totally new to this one - please correct me if needed):
1) You will have to create your own template directory (for example ~/.lazarus/mytemplates) and set this in Lazarus (menu: Tools -> Project Template Options).
2) For stuff to appear you will need at least one template;
- Create a directory in your template directory (for example ~/.lazarus/mytemplates/myfirsttemplate)
- Copy your project files in this new directory (*.lfm, *.pas, *.ico, *.lpi, *.lpr, *.res)
3) create a "project.ini" file in the new template directory.
I think the minimum is something like this:
project.ini:
[Variables]
[Project]
Name=OSX Notebook Header FormOptional:
The nice thing of Project Templates is that it supports variables.
Since a project will probably not be named the same as your example template you will have to do some code editing and file renaming.
Files:
Rename the project file (ico, lpi, lpr, res) to
__PROJNAME__.ext (where extension is the original extension of course).
For example: project.lpi becomes __PROJNAME__.lpi.
Note: the content of the lpi file might need some cleaning, for example removing history, reference to files, not sure if the lpi file is even needed.
File content:
For all files that referred to project.lpi etc, change the content of your files so all "project" references become "__PROJNAME__" (with the quotes).
You can optionally define your own variables, for example to give the "unit.pas" a different filename.
You could define for example __MAINUNIT__ and __MAINFORM__ in project.ini as MAINUNIT and MAINFORM - during creation Lazarus will ask you for these names.
Now every occurrence of __MAINUNIT__ for example will be replaced with the text you provided (avoid special characters and spaces).
Note that this works for all variables; Every occurrence of a variable in filenames and file content will be replaced by what you entered on creation of a new project based on your template. Predefined variables are
PROJNAME and
PROJDIR but I didn't find a purpose for PROJDIR just yet.
Some examples:
project.ini
[Variables]
MAINUNIT=mainunit
MAINFORM=mainform
[Project]
Name=OSX Notebook Header Form
Author=Hansaplast
Description=Lazarus LCL Application modified to make the main form look like a OS X notebook header__PROJNAME__.lpr:
program __PROJNAME__;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, __MAINUNIT__;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(T__MAINFORM__, __MAINFORM__);
Application.Run;
end.
__MAINUNIT__.pas:
unit __MAINUNIT__;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Buttons, StdCtrls, LCLIntf, LCLType, ComCtrls;
type
{ __MAINFORM__ }
T__MAINFORM__ = class(TForm)
...
procedure T__MAINFORM__.FormPaint(Sender: TObject);
...
//etc
__MAINUNIT__.lfm:
object __MAINFORM__: T__MAINFORM__
...
Keep in mind that I threw this text quickly together after playing with Project Templates for the first time, so I'm sure it can be fine tuned ...
Just thought it might be helpful for others.