Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-08

[Feature request] Add PNF image to Package

14 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to Zaher Dirkey

?

Zaher Dirkey hat am 31. August 2011 um 15:03 geschrieben:

Show quoted text 7 lines
Hi, Is it possible in the future to have this feature Add an png file to the package, when compile the package it automatically convert it to the .lrs file related to this package, it is useful for adding image icons for our controls.

When you create a new component for a package you can select an icon (not only png).
Creating an lrs from a png is a one liner on the console/terminal. ?
?
Mattias
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110831/099ac2e2/attachment.html>

Reply by email

Zaher Dirkey
to Mattias Gaertner

2011/8/31 Mattias Gaertner

Show quoted text 21 lines
** Zaher Dirkey hat am 31. August 2011 um 15:03 geschrieben: Hi, Is it possible in the future to have this feature Add an png file to the package, when compile the package it automatically convert it to the .lrs file related to this package, it is useful for adding image icons for our controls. When you create a new component for a package you can select an icon (not only png). Creating an lrs from a png is a one liner on the console/terminal.

Thanks for your replay, but it is more easy for newbe Lazarus users or for lazy people like me.
BTW, why i cant add it to the source directly e.g.{$r afile.png}, like as i do it with {$r afile.lfm}, it is related to FreePascal.

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110831/66125cf8/attachment.html>

Reply by email

Howard Page-Clark
to Zaher Dirkey
Zaher Dirkey wrote 13 lines
> Is it possible in the future to have this feature > > Add an png file to the package, when compile the package it > automatically convert it to the .lrs file related to this package, > it is useful for adding image icons for our controls. When you create a new component for a package you can select an icon (not only png). Creating an lrs from a png is a one liner on the console/terminal. Thanks for your replay, but it is more easy for newbe Lazarus users or for lazy people like me.

I presume you are aware that selecting an icon for a new component in the Package Editor causes automatic generation of an appropriate .lrs file for the icon, provided the icon has the same name as the new component class (ignoring extension), and that it is no bigger than 24x24 pixels? Lazarus also auto-generates in the Register procedure an appropriate {$I componentUnitName_icon.lrs} line as well. So provided you are only adding one new component, everything is done for you by the IDE, except for designing the icon.
If you want several icons to be registered in one unit for several components, then you do have to write a bit of code, and use the lazres.exe tool to generate the correct .lrs file yourself.

Howard

Reply by email

Zaher Dirkey
to Howard Page-Clark
Howard Page-Clark wrote 32 lines
On 31/8/11 3:34, Zaher Dirkey wrote: > Is it possible in the future to have this feature >> >> Add an png file to the package, when compile the package it >> automatically convert it to the .lrs file related to this package, >> it is useful for adding image icons for our controls. >> > > When you create a new component for a package you can select an icon > (not only png). > > Creating an lrs from a png is a one liner on the console/terminal. > > Thanks for your replay, but it is more easy for newbe Lazarus users or > for lazy people like me. > I presume you are aware that selecting an icon for a new component in the Package Editor causes automatic generation of an appropriate .lrs file for the icon, provided the icon has the same name as the new component class (ignoring extension), and that it is no bigger than 24x24 pixels? Lazarus also auto-generates in the Register procedure an appropriate {$I componentUnitName_icon.lrs} line as well. So provided you are only adding one new component, everything is done for you by the IDE, except for designing the icon. If you want several icons to be registered in one unit for several components, then you do have to write a bit of code, and use the lazres.exe tool to generate the correct .lrs file yourself. Howard

The idea, i have some of icons in a package, sometime i redesign it, i forget to recall lazres, i put batch file for it, but it is not bad idea to when compiling the package it also call lazres automatically for it.

It is not that necessary feature, so you can ignore it, but how can i make it without touch the Lazarus source, Is Addons allow me to do that?

Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110831/9a2cb371/attachment-0001.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 7 lines
[...] The idea, i have some of icons in a package, sometime i redesign it, i forget to recall lazres, i put batch file for it, but it is not bad idea to when compiling the package it also call lazres automatically for it. It is not that necessary feature, so you can ignore it, but how can i make it without touch the Lazarus source, Is Addons allow me to do that?

Yes.

Mattias

Reply by email

Paul Ishenin
to Zaher Dirkey: 2011/8/31 Mattias Gaertner Thanks for your replay, but it is more easy for newbe Lazarus…
Zaher Dirkey wrote
BTW, why i cant add it to the source directly e.g.{$r afile.png}, like as i do it with {$r afile.lfm}, it is related to FreePascal.

You can place an image into a BITMAP resource and add it to the package using {$R mybitmap.res}. Image must be in .bmp format.

But if you want to add a png resource there are few problems:
1. Windows does not have a png resource type.
2. FPC does not know how to interprete {$R afile.png}
3. TPortableNetworkGraphics class has no method to load from a windows resource.

You can try to solve those problems starting from the first.

Best regards,
Paul Ishenin.

Reply by email

Alexander Klenin
to Mattias Gaertner: On Wed, 31 Aug 2011 22:34:22 +0300 Yes. Mattias
Mattias Gaertner wrote
> It is not that necessary feature, so you can ignore it, but how can i make > it without touch the Lazarus source, Is Addons allow me to do that? Yes.

Hm, I have also encountered this problem.
What "Addons" are you talking about?

Also, it is annoying that even changing .lrs still does not trigger recompilation.
My usual workflow is as follows:
1) add or change icon
2) run lazres
3) rebuild Lazarus
4) curse :-)
5) manually touch some source file
6) rebuild Lazarus again

Alexander S. Klenin

Reply by email

Mattias Gaertner
to Alexander Klenin
Show quoted text 12 lines
On Thu, Sep 1, 2011 at 07:02, Mattias Gaertner wrote: >> It is not that necessary feature, so you can ignore it, but how can i make >> it without touch the Lazarus source, Is Addons allow me to do that? > > Yes. Hm, I have also encountered this problem. What "Addons" are you talking about? Also, it is annoying that even changing .lrs still does not trigger recompilation.

The compiler does not check include files.
I don't know why. Maybe you can create a FPC feature request.

Mattias

Reply by email

Alexander Klenin
to Mattias Gaertner
Mattias Gaertner wrote
The compiler does not check include files. I don't know why. Maybe you can create a FPC feature request.

Hm. In my simple test, it does. Maybe you mean resource files?

Alexander S. Klenin

Reply by email

Mattias Gaertner
to Alexander Klenin
Show quoted text 6 lines
On Thu, Sep 1, 2011 at 18:49, Mattias Gaertner wrote: > The compiler does not check include files. > I don't know why. Maybe you can create a FPC feature request. Hm. In my simple test, it does.

Yes, sorry. I did a quick test. The test was wrong.

Then I don't understand the problem.

Mattias

Reply by email