Revision number in IDE main window caption lazarus / 9-Editor ---------------------------------------------------------------------- zoltanleo · 2018-08-25 16:03 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 ---------------------------------------------------------------------- JuhaManninen · 2018-08-25 16:39 Quote from: zoltanleo on August 25, 2018, 06:03:37 pmIt'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. ---------------------------------------------------------------------- howardpc · 2018-08-25 16:43 You can hack ..lazarus/ide/main.pp the line that is currently Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   NewCaption := Format(lisLazarusEditorV, [GetLazarusVersionString]);can be replaced with: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 · 2018-08-25 16:53 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. ---------------------------------------------------------------------- zoltanleo · 2018-08-25 19:37 Quote from: howardpc on August 25, 2018, 06:43:38 pmYou can hack ..lazarus/ide/main.ppGreat gratitude for the correct council. I have a little changed a code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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. ---------------------------------------------------------------------- lucamar · 2018-08-25 20:02 Quote from: zoltanleo on August 25, 2018, 09:37:19 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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. ---------------------------------------------------------------------- JuhaManninen · 2018-08-25 20:21 Quote from: lucamar on August 25, 2018, 10:02:28 pmOne 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. ---------------------------------------------------------------------- Mike.Cornflake · 2018-08-25 20:29 Pre-empting :-) http://wiki.lazarus.freepascal.org/Creating_A_Patch http://wiki.lazarus.freepascal.org/How_do_I_create_a_bug_report ---------------------------------------------------------------------- zoltanleo · 2018-08-25 20:45 Quote from: lucamar on August 25, 2018, 10:02:28 pmOne 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 ---------------------------------------------------------------------- lucamar · 2018-08-25 21:06 Quote from: zoltanleo on August 25, 2018, 10:45:03 pmBy the way, in the same way the fpc version is taken in aboutfrm.pas  Yeah, I know, but in the about box is more clear what it refers to. And it's not so much "in your face" ---------------------------------------------------------------------- zoltanleo · 2018-08-25 22:03 Quote from: JuhaManninen on August 25, 2018, 10:21:44 pmzoltanleo, 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 . In case the line of revision number is empty, then I see an approximate code such: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if GetLazarusRevision = ''         then           NewCaption := Format(lisLazarusEditorV, [GetLazarusVersionString])        else         NewCaption := Format(lisLazarusEditorV + lisMainWinSVNRevision + ' | ' + lisMainWinFPCVersion, [GetLazarusVersionString, GetLazarusRevision,{$I %FPCVERSION%}]); Quote from: Mike.Cornflake on August 25, 2018, 10:29:58 pmPre-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.  Quote from: lucamar on August 25, 2018, 11:06:40 pmYeah, 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. ---------------------------------------------------------------------- lucamar · 2018-08-25 23:14 Quote from: zoltanleo on August 26, 2018, 12:03:58 amAt 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) 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.)? ---------------------------------------------------------------------- JuhaManninen · 2018-08-26 08:31 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. Quote from: zoltanleo on August 26, 2018, 12:03:58 amIt 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. ---------------------------------------------------------------------- wp · 2018-08-26 11:01 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 · 2018-08-26 11:08 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. ---------------------------------------------------------------------- JuhaManninen · 2018-08-26 13:06 Quote from: Thaddy on August 26, 2018, 01:08:00 pmThe 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. No, M means there are local modifications in addition to the code from Subversion. Run "svn revert -R ." and the M goes away. ---------------------------------------------------------------------- zoltanleo · 2018-08-26 19:34 Quote from: JuhaManninen on August 26, 2018, 10:31:43 amzoltanleo, you forgot to check for 'Unknown' value.Because I didn't know about it. Quote from: JuhaManninen on August 26, 2018, 10:31:43 amThe IDE can be compiled with any FPC version, there is no relation between those 2.You are absolutely right. I have lost sight of this nuance Quote from: JuhaManninen on August 26, 2018, 10:31:43 amYou cannot do even "svn up" then, can you? The .svn folder of Lazarus repo takes 12 MB here. HDs today have hundreds of GB.OMG. It will seem strange. But I for some reason considered that .svn folder occupies about 1 Gb. I cruelly was mistaken ---------------------------------------------------------------------- wp · 2018-08-26 21:15 Quote from: JuhaManninen on August 26, 2018, 10:31:43 amThe .svn folder of Lazarus repo takes 12 MB here. Really? Mine has 400 MB. (Still no problem for the HD, though). ---------------------------------------------------------------------- Bart · 2018-08-26 21:22 Quote from: wp on August 26, 2018, 11:15:32 pmQuote from: JuhaManninen on August 26, 2018, 10:31:43 amThe .svn folder of Lazarus repo takes 12 MB here. Really? Mine has 400 MB. (Still no problem for the HD, though). 1.17 GB here ... Bart ---------------------------------------------------------------------- JuhaManninen · 2018-08-26 22:03 Quote from: zoltanleo on August 26, 2018, 09:34:37 pmOMG. It will seem strange. But I for some reason considered that .svn folder occupies about 1 Gb. I cruelly was mistaken  Sorry, my bad. I failed to see the subdirectory sizes under .svn. The actual size here is about half a GB. Maybe it grows when you modify and update often. I don't use it much for development, I use Git instead. Interestingly, the .git directory of Lazarus Git repo got by git-svn link is smaller. It is a little over 100 MB although it contains all the commit history since 2015. In a mirror with full history it is over 300 MB, still way smaller than the .svn dir. Wow! It means Git can be recommended when HD size is of concern.