Recent

Author Topic: Revision number in IDE main window caption  (Read 8771 times)

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Revision number in IDE main window caption
« on: August 25, 2018, 06:03:37 pm »
Hi guys.

It's possible to correct a code so that information of revision number of IDE was displayed?

ps. I'm aware that revision number is here {LazDir}\ide\revision.inc
« Last Edit: August 25, 2018, 11:05:37 pm by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Revision number in designer caption
« Reply #1 on: August 25, 2018, 06:39:19 pm »
It's possible to correct a code so that information of revision number of IDE was displayed?
Actually it is a good idea. The revision could be shown in parenthesis but only when it is available. The release versions would not try to show it then.
A patch would be accepted. The About dialog code can be used as an example of how to do it. I remember the actual code for getting a revision is long because it supports both SVN and Git repositories. A correct SVN revision can be found also from a Git mirror repo.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Revision number in designer caption
« Reply #2 on: August 25, 2018, 06:43:38 pm »
You can hack ..lazarus/ide/main.pp
the line that is currently
Code: Pascal  [Select][+][-]
  1.   NewCaption := Format(lisLazarusEditorV, [GetLazarusVersionString]);
can be replaced with:
Code: Pascal  [Select][+][-]
  1. NewCaption := Format(lisLazarusEditorV+' Revision: %s', [GetLazarusVersionString, GetLazarusRevision]);
It is line #8351 in my Lazarus, but might be slightly different in yours.
Rebuild the IDE, et voila.
A proper patch should be more considered, however, not a mere off the top of the head hack.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Revision number in designer caption
« Reply #3 on: August 25, 2018, 06:53:11 pm »
You mean in your application?
You could try adding the revision.inc file to your project.   This will require you to maintain relative folder structure between your Lazarus installation and your project.   I've been unable to find any other way.

Or do you mean in the IDE itself?  Looks to me like you'd need to patch main.pp  Find "procedure TMainIDE.UpdateCaption;".  Although I haven't tested, from inside that unit you should be able to use LazarusRevisionStr direct.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: Revision number in designer caption
« Reply #4 on: August 25, 2018, 09:37:19 pm »
You can hack ..lazarus/ide/main.pp
Great gratitude for the correct council. I have a little changed a code:
Code: Pascal  [Select][+][-]
  1. NewCaption := Format(lisLazarusEditorV + ' rev.%s | FPC v%s', [GetLazarusVersionString, GetLazarusRevision,{$I %FPCVERSION%}]);
and I have received desirable result.

I would be very grateful to developers if these changes are made to the new version. ;)
« Last Edit: August 25, 2018, 09:44:10 pm by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Revision number in designer caption
« Reply #5 on: August 25, 2018, 10:02:28 pm »
Code: Pascal  [Select][+][-]
  1. NewCaption := Format(lisLazarusEditorV + ' rev.%s | FPC v%s', [GetLazarusVersionString, GetLazarusRevision,{$I %FPCVERSION%}]);

One little thing: {$I %FPCVERSION%} introduces the version of FPC with which Lazarus was built, not the version which it'll use to build your projects. They will, normally, coincide but if not it may introduce some confussion.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Revision number in designer caption
« Reply #6 on: August 25, 2018, 10:21:44 pm »
One little thing: {$I %FPCVERSION%} introduces the version of FPC with which Lazarus was built, not the version which it'll use to build your projects. They will, normally, coincide but if not it may introduce some confussion.
True, if FPC version is added there, it should have an option in the Environment -> Window pane. Then people who set the option know what they are doing and will not be confused.
The Lazarus revision however can be added to Lazarus IDE main window caption without confusion.
zoltanleo, can you please provide a patch. Remember to show the "rev. xxx" part only when it is available. We don't want any "unknown" text or similar there.

BTW, the subject "Revision number in designer caption" is wrong. We are dealing with IDE main window caption here.
« Last Edit: August 25, 2018, 10:24:31 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: Revision number in designer caption
« Reply #8 on: August 25, 2018, 10:45:03 pm »
One little thing: {$I %FPCVERSION%} introduces the version of FPC with which Lazarus was built, not the version which it'll use to build your projects. They will, normally, coincide but if not it may introduce some confussion.
I haven't met a problem when changing fpc. It is enough to specify path to other fpc version and to recompile IDE.

By the way, in the same way the fpc version is taken in aboutfrm.pas  :-X
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Revision number in designer caption
« Reply #9 on: August 25, 2018, 11:06:40 pm »
By the way, in the same way the fpc version is taken in aboutfrm.pas  :-X

Yeah, I know, but in the about box is more clear what it refers to.
And it's not so much "in your face" :D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: Revision number in designer caption
« Reply #10 on: August 26, 2018, 12:03:58 am »
zoltanleo, can you please provide a patch. Remember to show the "rev. xxx" part only when it is available. We don't want any "unknown" text or similar there.
It is easy to me to make it technically, but I can't provide in what cases revision number will be designated as <unknown>. In case the line of revision number is empty, then I see an approximate code such:

Code: Pascal  [Select][+][-]
  1. if GetLazarusRevision = ''
  2.         then
  3.           NewCaption := Format(lisLazarusEditorV, [GetLazarusVersionString])
  4.         else
  5.           NewCaption := Format(lisLazarusEditorV + lisMainWinSVNRevision + ' | ' + lisMainWinFPCVersion, [GetLazarusVersionString, GetLazarusRevision,{$I %FPCVERSION%}]);

Pre-empting :-)
It isn't necessary to laugh. I usually delete the .svn folder after the first compilation of IDE to make room on hdd. After this svn-client works incorrectly.  :-[

Yeah, I know, but in the about box is more clear what it refers to.
At me it can be at the same time started 2-3 IDE (for example when I check some code for different versions of IDE or fpc). Thus, I can see information necessary for me quickly.
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Revision number in designer caption
« Reply #11 on: August 26, 2018, 01:14:33 am »
At me it can be at the same time started 2-3 IDE (for example when I check some code for different versions of IDE or fpc). Thus, I can see information necessary for me quickly.
I, however, prefer cleaner main form captions with just the basic info: program and document names (and in Lazarus' case, build mode) <shrugs> Each to its own, I suppose. Which means showing all this extra info should be optional (like in the case of build mode).

Of course, then somebody else will want to add another tidbit of "absolutely neccessary"(tm) info ... Hey! That's an idea! How about using a user-configurable format string including $Whatever() macros (say $ProjPath, etc.)?  ;D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Revision number in designer caption
« Reply #12 on: August 26, 2018, 10:31:43 am »
Ok, I implemented showing the Lazarus SVN revision in r58779. It is easier to implement than I anticipated, the value is already in revision.inc file.
zoltanleo, you forgot to check for 'Unknown' value.
The FPC version used for compiling the IDE must not go there by default.
As lucamar noted, a user may wrongly think his projects will be compiled with that compiler. No, there is a "Compiler executable" setting for that. The IDE can be compiled with any FPC version, there is no relation between those 2.

It isn't necessary to laugh. I usually delete the .svn folder after the first compilation of IDE to make room on hdd. After this svn-client works incorrectly.  :-[
You cannot do even "svn up" then, can you? The .svn folder of Lazarus repo takes 12 MB here. HDs today have hundreds of GB.
You provided an additional Git-formatted patch. Apparently you have space for a Git mirror repo.
Anyway, thanks for the patch(es). I modified the code based on it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Revision number in IDE main window caption
« Reply #13 on: August 26, 2018, 01:01:44 pm »
Thank you. Very useful feature.

BTW: My trunk now displays "Lazarus IDE v1.9.0 rev.58779M - project1". What does the "M" after the revision number mean? It not contained in the list of svn log.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Revision number in IDE main window caption
« Reply #14 on: August 26, 2018, 01:08:00 pm »
The M stands for "modified" and is an svn feature. It indicates that the revision is only a modification.
E.g. if you check out a release and run svnversion, there is no M, if you check out trunk you will usually get an M unless it was just branched.
« Last Edit: August 26, 2018, 01:23:31 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018