[Lazarus] Modifying the "File -> New Unit" template

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Modifying the "File -> New Unit" template

Free Pascal - Lazarus mailing list
Hi,

Is there a way to modify the standard “file -> new unit” code template
that is used? Or is what we see hard-coded into the Lazarus IDE executable?

I'm using Lazarus 1.7 r52715 FPC 2.6.4 x86_64-linux-gtk 2

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Modifying the "File -> New Unit" template

Free Pascal - Lazarus mailing list
On Tue, 11 Apr 2017 11:22:01 +0100
Graeme Geldenhuys via Lazarus <[hidden email]> wrote:

> Hi,
>
> Is there a way to modify the standard “file -> new unit” code template
> that is used? Or is what we see hard-coded into the Lazarus IDE executable?

Right click in the IDE coolbar on the "New unit" button to select
another template.
A package can register other templates.

Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Modifying the "File -> New Unit" template

Free Pascal - Lazarus mailing list
On 2017-04-11 11:46, Mattias Gaertner via Lazarus wrote:
> Right click in the IDE coolbar on the "New unit" button to select
> another template.

I meant I want to modify the code that Lazarus IDE gives once I click
“File -> New Unit”. I don't want a completely different template. eg:
this is the default I see now...

====================
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

implementation

end.
===================

I want to change that so the default has difference uses clauses,
defines the text encoding of the source file etc. Where does the above
code come from? Hard-coded?

eg:
  MSEide has a ‘templates’ folder where all such auto-generated code is
  defined. Nothing is hard-coded in the MSEide executable. From your
  answer I assume Lazarus doesn’t do anything like this, and instead
  hard-codes such default unit templates. :-/


> A package can register other templates.

I'll wait on your reply before I delve into this.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Modifying the "File -> New Unit" template

Free Pascal - Lazarus mailing list
On Tue, 11 Apr 2017 12:02:05 +0100
Graeme Geldenhuys via Lazarus <[hidden email]> wrote:

>[...]
> I want to change that so the default has difference uses clauses,
> defines the text encoding of the source file etc. Where does the above
> code come from? Hard-coded?

Yes, components/ideintf/projectintf.pas TFileDescPascalUnit
It creates the code from various IDE options and packages can define
their descendants to replace whole or parts.

> eg:
>   MSEide has a ‘templates’ folder where all such auto-generated code is
>   defined. Nothing is hard-coded in the MSEide executable. From your
>   answer I assume Lazarus doesn’t do anything like this, and instead
>   hard-codes such default unit templates. :-/

It should be easy to add a "user unit" template, that loads the source
from a file and replaces some macros.

Mattias
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus