Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-15 Thread Mattias Gaertner
On Thu, 14 Sep 2006 09:22:10 +0200 (Romance Daylight Time)
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> 
> 
> On Wed, 13 Sep 2006, Mattias Gaertner wrote:
> 
> > On Wed, 13 Sep 2006 20:54:05 +0200
> > Jouke Rensma <[EMAIL PROTECTED]> wrote:
> >
> >> Mattias,
> >>
> >> When you use the VersionInfo for the first time, the main source is
> >> not updated with a $R .res} line. The code as it is
> >> now, updates this using the codetools. However, this happens after
> >> all files have been saved for compilation. This results in that
> >> main source is updated, but the compiler uses the file from disk
> >> without the updated line.
> >>
> >> Saving the file can be easily done using TCodeBuffer.SaveToFile.
> >> However this does not reset the modified flag. Result will be that
> >> lazarus asks to save the file, while the file on disk is already up
> >> to date.
> >>
> >> I searched trough the codetools, but could not find out how to
> >> solve this problem. What should I use???
> >
> > The $R should be added, when the project is created or the version
> > info is enabled (when clicking the ok button of the project
> > options). Not on build and not on saving project.
> >
> > BTW,
> > How do you make sure, that the $R is only used under windows?
> > If you create a project under windows with version info and compile
> > it under linux, the same source must compile without changing the
> > source. With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?
> 
> Isn't it better to do:
> 
> {$IFDEF LazarusVersionInfo}{$R projectname.res}{$ENDIF}
> 
> The IDE can define this whenever it is necessary.

Good idea. When some new targets support resource files with version
information, the IFDEF will stay short.
OTOH: Is there any other platform with version resource files?


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-15 Thread Mattias Gaertner
On Thu, 14 Sep 2006 11:19:51 +0200
Jouke Rensma <[EMAIL PROTECTED]> wrote:

> This patch solves the problem! The main source is now updated when
> clicking the OK button in the project options. While the default
> setting for UseVersionInfo is false, it is not needed to update the
> main source on project creation. 

Thanks. Applied.

 
> Outstanding todo's:
>  - wrap the {$R ...} in {IFDEF} {ENDIF}. Can 
> CodeToolBoss.AddResourceDirective handle this somehow?

Not yet.


>  - verify which os's can use VersionInfo: win32 does, but what about
> wince, win64?

I leave this question for the windows experts.

>  - when you don't want to include VersionInfo anymore, the {$R...}
> line should be deleted from the main source. Is there something like 
> CodeToolBoss.DeleteResourceDirective? 

Not yet.
I will add this soon. We are currently preparing lazarus 0.9.18.


Mattias


> 
> Jouke 
> 
> 
> Mattias Gaertner writes: 
> 
> > On Wed, 13 Sep 2006 20:54:05 +0200
> > Jouke Rensma <[EMAIL PROTECTED]> wrote: 
> > 
> >> Mattias,  
> >> 
> >> When you use the VersionInfo for the first time, the main source is
> >> not updated with a $R .res} line. The code as it is
> >> now, updates this using the codetools. However, this happens after
> >> all files have been saved for compilation. This results in that
> >> main source is updated, but the compiler uses the file from disk
> >> without the updated line.  
> >> 
> >> Saving the file can be easily done using TCodeBuffer.SaveToFile.
> >> However this does not reset the modified flag. Result will be that
> >> lazarus asks to save the file, while the file on disk is already up
> >> to date.  
> >> 
> >> I searched trough the codetools, but could not find out how to
> >> solve this problem. What should I use??? 
> > 
> > The $R should be added, when the project is created or the version
> > info is enabled (when clicking the ok button of the project
> > options). Not on build and not on saving project. 
> > 
> > BTW,
> > How do you make sure, that the $R is only used under windows?
> > If you create a project under windows with version info and compile
> > it under linux, the same source must compile without changing the
> > source. With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ? 
> > 
> > 
> > Mattias 
> > 
> > _
> >  To unsubscribe: mail [EMAIL PROTECTED] with
> > "unsubscribe" as the Subject
> >archives at http://www.lazarus.freepascal.org/mailarchives
>  
> 

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-14 Thread Michael Van Canneyt



On Wed, 13 Sep 2006, Mattias Gaertner wrote:


On Wed, 13 Sep 2006 20:54:05 +0200
Jouke Rensma <[EMAIL PROTECTED]> wrote:


Mattias,

When you use the VersionInfo for the first time, the main source is
not updated with a $R .res} line. The code as it is now,
updates this using the codetools. However, this happens after all
files have been saved for compilation. This results in that main
source is updated, but the compiler uses the file from disk without
the updated line.

Saving the file can be easily done using TCodeBuffer.SaveToFile.
However this does not reset the modified flag. Result will be that
lazarus asks to save the file, while the file on disk is already up
to date.

I searched trough the codetools, but could not find out how to solve
this problem. What should I use???


The $R should be added, when the project is created or the version info
is enabled (when clicking the ok button of the project options). Not on
build and not on saving project.

BTW,
How do you make sure, that the $R is only used under windows?
If you create a project under windows with version info and compile it
under linux, the same source must compile without changing the source.
With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?


Isn't it better to do:

{$IFDEF LazarusVersionInfo}{$R projectname.res}{$ENDIF}

The IDE can define this whenever it is necessary.

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-13 Thread Vincent Snijders

Mattias Gaertner wrote:

On Wed, 13 Sep 2006 21:47:11 +0200
Vincent Snijders <[EMAIL PROTECTED]> wrote:



Mattias Gaertner wrote:


On Wed, 13 Sep 2006 20:54:05 +0200
BTW,
How do you make sure, that the $R is only used under windows?
If you create a project under windows with version info and compile
it under linux, the same source must compile without changing the
source. With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?


I think it is better to use
{$IFDEF Windows}{$R projectname.res}{$ENDIF}

MSWindows is not defined for wince.



If version info works for wince too, then the version info has a bug.
It only works for TargetOS='win32' (hardcoded).



If this is the case, then {$IFDEF win32} should be used, because 
MSWindows is also defined for win64.


Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-13 Thread Mattias Gaertner
On Wed, 13 Sep 2006 21:47:11 +0200
Vincent Snijders <[EMAIL PROTECTED]> wrote:

> Mattias Gaertner wrote:
> > On Wed, 13 Sep 2006 20:54:05 +0200
> > BTW,
> > How do you make sure, that the $R is only used under windows?
> > If you create a project under windows with version info and compile
> > it under linux, the same source must compile without changing the
> > source. With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?
> 
> I think it is better to use
> {$IFDEF Windows}{$R projectname.res}{$ENDIF}
> 
> MSWindows is not defined for wince.

If version info works for wince too, then the version info has a bug.
It only works for TargetOS='win32' (hardcoded).


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-13 Thread Vincent Snijders

Mattias Gaertner wrote:

On Wed, 13 Sep 2006 20:54:05 +0200
BTW,
How do you make sure, that the $R is only used under windows?
If you create a project under windows with version info and compile it
under linux, the same source must compile without changing the source.
With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?


I think it is better to use
{$IFDEF Windows}{$R projectname.res}{$ENDIF}

MSWindows is not defined for wince.

Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] VersionInfo - Question on saving the main source file

2006-09-13 Thread Mattias Gaertner
On Wed, 13 Sep 2006 20:54:05 +0200
Jouke Rensma <[EMAIL PROTECTED]> wrote:

> Mattias, 
> 
> When you use the VersionInfo for the first time, the main source is
> not updated with a $R .res} line. The code as it is now,
> updates this using the codetools. However, this happens after all
> files have been saved for compilation. This results in that main
> source is updated, but the compiler uses the file from disk without
> the updated line. 
> 
> Saving the file can be easily done using TCodeBuffer.SaveToFile.
> However this does not reset the modified flag. Result will be that
> lazarus asks to save the file, while the file on disk is already up
> to date. 
> 
> I searched trough the codetools, but could not find out how to solve
> this problem. What should I use??? 

The $R should be added, when the project is created or the version info
is enabled (when clicking the ok button of the project options). Not on
build and not on saving project.

BTW,
How do you make sure, that the $R is only used under windows?
If you create a project under windows with version info and compile it
under linux, the same source must compile without changing the source.
With {$IFDEF MSWindows}{$R projectname.res}{$ENDIF} ?


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives