From 27461c4823ecd118febab58e31201f5ef128d3d3 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 5 Nov 2010 19:26:20 +0000 Subject: [PATCH] IDE: added about IDE info dialog git-svn-id: trunk@28101 - --- .gitattributes | 2 + ide/compileroptions.pp | 87 ----------------------- ide/idefpcinfo.pas | 4 +- ide/ideinfodlg.lfm | 22 ++++++ ide/ideinfodlg.pas | 133 ++++++++++++++++++++++++++++++++++++ ide/lazarus.lpi | 9 ++- ide/lazarusidestrconsts.pas | 2 + ide/main.pp | 19 ++++-- ide/mainbar.pas | 1 + ide/mainbase.pas | 1 + 10 files changed, 184 insertions(+), 96 deletions(-) create mode 100644 ide/ideinfodlg.lfm create mode 100644 ide/ideinfodlg.pas diff --git a/.gitattributes b/.gitattributes index 768403b418..0f02eb2c6b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3726,6 +3726,8 @@ ide/idecontexthelpedit.pas svneol=native#text/plain ide/idedefs.pas svneol=native#text/pascal ide/idefpcinfo.lfm svneol=native#text/plain ide/idefpcinfo.pas svneol=native#text/plain +ide/ideinfodlg.lfm svneol=native#text/plain +ide/ideinfodlg.pas svneol=native#text/plain ide/ideoptiondefs.pas svneol=native#text/pascal ide/ideoptionsdlg.lfm svneol=native#text/plain ide/ideoptionsdlg.pas svneol=native#text/pascal diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index b26185a3cb..808296e9a9 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -29,93 +29,6 @@ * * *************************************************************************** - build modes: - - Done: - - IDEIntf build macro: TLazBuildMacro: identifier, description, - values, valuedescriptions, defaultvalue:string, - - IDE build macro: TIDEBuildMacro, load/save to xmlconfig - - BuildMacroChangeStamp: - - changed on used packages, IncreaseBuildMacroChangeStamp - - remove TBuildModeGraph - - remove TBuildModeFlag - - remove TBuildMode - - remove TDefaultBuildModeGraph - - project can define values for build macros - - load/save to xmlconfig - - project can define values for build macros - - edit them in the compiler options - - edit name - - edit value - - add value - - delete value - - Every package and project can define a list of build macros. - - load/save to xmlconfig - - Every package and project can define a list of build macros. - - edit in compiler options: - - new - - rename - - delete - - add value - - delete value - - edit default value - - a function to compute the build macro values - - using the project macro values - - using the inherited values - - using the conditionals - - build macro values are invalidated when changing project macro values or - any conditionals - - using conditionals to extend paths: TParsedCompilerOptions.GetUnparsedWithConditionals - - using conditionals to extend package usage paths: TParsedCompilerOptions.GetUnparsedWithConditionals - - conditionals editor for project - - warn for macro name conflicts - - on renaming - - IDE macros like CompPath - - keywords - - with standard macros - - prefix with package name - - with macros from other packages/projects - - show build macros in inherited compiler options - - use syntax highlighter settings like the editor previews - - show syntax errors of conditionals - - when package is renamed, rename macros too - - moved the project target file to compiler options - - code completion - - keywords - - operands - - inherited macros - - project macros - - own macros - - words in conditionals - - result identifiers - - history - - refactor compiler options (default options, load, save to file) - - disabled project compiler options, used only for storage - - replaced project compiler options OwnerProject+Project with LazProject - - addded changestamp, assign, equals to compiler options - - added buildmodes to project - - moved compileroptions and macrovalues to active buildmode - - compiler options: work on real options - - backup before read with modified flags - - restore on cancel - - TProjectBuildMacros: CreateDiff - - a project can save the set of build macros and compiler options - - store sets in lpi - - the default build mode is stored in the old xml path, so that - old IDEs can open newer projects. - - store sets in lps - - store active build mode in session - - edit build modes: - - add - - delete - - move up, down - - make active - - a popup menu on IDE palette to quickly switch the build mode - - a diff tool to compare two build modes - - Makefile: - - create special Makefile.compiled file, which is copied after compile - to be used by the IDE - ToDo: - create Makefile: - create a special .compiled file diff --git a/ide/idefpcinfo.pas b/ide/idefpcinfo.pas index 84659ed766..44b8e12dc4 100644 --- a/ide/idefpcinfo.pas +++ b/ide/idefpcinfo.pas @@ -74,7 +74,7 @@ end; procedure TIDEFPCInfoDialog.FormCreate(Sender: TObject); begin - Caption:='Information about used FPC'; + Caption:=lisInformationAboutUsedFPC; UpdateMemo; end; @@ -102,8 +102,8 @@ begin FPCSrcDir:=EnvironmentOptions.GetFPCSourceDirectory; // needs FPCVer macro UnitSetCache:=CodeToolBoss.FPCDefinesCache.FindUnitSet( CompilerFilename,TargetOS,TargetCPU,'',FPCSrcDir,true); - GatherFPCExecutable(UnitSetCache,sl); + Memo1.Lines.Assign(sl); finally sl.Free; diff --git a/ide/ideinfodlg.lfm b/ide/ideinfodlg.lfm new file mode 100644 index 0000000000..1a57c68f11 --- /dev/null +++ b/ide/ideinfodlg.lfm @@ -0,0 +1,22 @@ +object IDEInfoDialog: TIDEInfoDialog + Left = 269 + Height = 330 + Top = 294 + Width = 644 + Caption = 'IDEInfoDialog' + ClientHeight = 330 + ClientWidth = 644 + OnCreate = FormCreate + LCLVersion = '0.9.29' + object Memo1: TMemo + Left = 0 + Height = 330 + Top = 0 + Width = 644 + Align = alClient + Lines.Strings = ( + 'Memo1' + ) + TabOrder = 0 + end +end diff --git a/ide/ideinfodlg.pas b/ide/ideinfodlg.pas new file mode 100644 index 0000000000..cefab86420 --- /dev/null +++ b/ide/ideinfodlg.pas @@ -0,0 +1,133 @@ +{ + *************************************************************************** + * * + * This source is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This code is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * General Public License for more details. * + * * + * A copy of the GNU General Public License is available on the World * + * Wide Web at . You can also * + * obtain it by writing to the Free Software Foundation, * + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************** + + Author: Mattias Gaertner + + Abstract: + IDE dialog showing stats about the IDE. +} +unit IDEInfoDlg; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + DefineTemplates, EnvironmentOpts, AboutFrm, LazConf; + +type + + { TIDEInfoDialog } + + TIDEInfoDialog = class(TForm) + Memo1: TMemo; + procedure FormCreate(Sender: TObject); + private + procedure GatherIDEVersion(sl: TStrings); + procedure GatherEnvironmentVars(sl: TStrings); + procedure GatherGlobalOptions(sl: TStrings); + public + procedure UpdateMemo; + end; + +var + IDEInfoDialog: TIDEInfoDialog; + +function ShowIDEInfo: TModalResult; + + +implementation + +function ShowIDEInfo: TModalResult; +var + Dlg: TIDEInfoDialog; +begin + Dlg:=TIDEInfoDialog.Create(nil); + try + Result:=Dlg.ShowModal; + finally + Dlg.Free; + end; +end; + +{$R *.lfm} + +{ TIDEInfoDialog } + +procedure TIDEInfoDialog.FormCreate(Sender: TObject); +begin + Caption:='Information about the IDE'; + + UpdateMemo; +end; + +procedure TIDEInfoDialog.GatherIDEVersion(sl: TStrings); +const + LazarusVersionStr= {$I version.inc}; +begin + sl.Add('Lazarus version: '+GetLazarusVersionString); + sl.Add('Lazarus svn revision: '+LazarusRevisionStr); + sl.Add('Lazarus build date: '+{$I %date%}); + sl.Add('Lazarus was compiled for '+GetCompiledTargetCPU+'-'+GetCompiledTargetOS); + sl.Add('Lazarus was compiled with fpc '+{$I %FPCVERSION%}); + sl.Add(''); +end; + +procedure TIDEInfoDialog.GatherEnvironmentVars(sl: TStrings); +var + i: Integer; +begin + sl.Add('Environment variables:'); + for i:=0 to GetEnvironmentVariableCount-1 do + sl.Add(GetEnvironmentStringUTF8(i)+'='+GetEnvironmentVariableUTF8(GetEnvironmentStringUTF8(i))); + sl.Add(''); +end; + +procedure TIDEInfoDialog.GatherGlobalOptions(sl: TStrings); +begin + sl.add('Global IDE options:'); + sl.Add('Primary config directory='+GetPrimaryConfigPath); + sl.Add('Secondary config directory='+GetSecondaryConfigPath); + sl.Add('LazarusDirectory='+EnvironmentOptions.LazarusDirectory); + sl.Add('CompilerFilename='+EnvironmentOptions.CompilerFilename); + sl.Add('CompilerMessagesFilename='+EnvironmentOptions.CompilerMessagesFilename); + sl.Add('FPC source directory='+EnvironmentOptions.GetFPCSourceDirectory); + sl.Add('Test directory='+EnvironmentOptions.GetTestBuildDirectory); + sl.Add(''); +end; + +procedure TIDEInfoDialog.UpdateMemo; +var + sl: TStringList; +begin + sl:=TStringList.Create; + try + GatherIDEVersion(sl); + GatherGlobalOptions(sl); + GatherEnvironmentVars(sl); + Memo1.Lines.Assign(sl); + finally + sl.Free; + end; +end; + +end. + diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index 1c95e44bef..01b57ace45 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -56,7 +56,7 @@ - + @@ -562,6 +562,13 @@ + + + + + + + diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index b24bb7e58a..2216c953b8 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -305,6 +305,7 @@ resourcestring lisMenuIDEInternals = 'IDE internals'; lisMenuPackageLinks = 'Package links ...'; lisMenuAboutFPC = 'About FPC'; + lisAboutIDE = 'About IDE'; lisMenuNewProject = 'New Project ...'; lisMenuNewProjectFromFile = 'New Project from file ...'; @@ -4951,6 +4952,7 @@ resourcestring lisDirectivesForNewUnit = 'Directives for new unit'; lisRemoveFromInstallList = 'Remove from install list'; lisKeepInInstallList = 'Keep in install list'; + lisInformationAboutUsedFPC = 'Information about used FPC'; implementation diff --git a/ide/main.pp b/ide/main.pp index 071eb02d61..edd5313d3b 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -137,12 +137,12 @@ uses IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView, BuildLazDialog, BuildProfileManager, BuildManager, CheckCompOptsForNewUnitDlg, MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory, - IDEFPCInfo, ProcessList, InitialSetupDlgs, NewDialog, MakeResStrDlg, - DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer, BuildFileDlg, - ProcedureList, ExtractProcDlg, FindRenameIdentifier, AbstractsMethodsDlg, - EmptyMethodsDlg, UnusedUnitsDlg, FindOverloadsDlg, CleanDirDlg, - CodeContextForm, AboutFrm, CompatibilityRestrictions, RestrictionBrowser, - ProjectWizardDlg, IDECmdLine, CodeExplOpts, + IDEFPCInfo, IDEInfoDlg, ProcessList, InitialSetupDlgs, NewDialog, + MakeResStrDlg, DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer, + BuildFileDlg, ProcedureList, ExtractProcDlg, FindRenameIdentifier, + AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, FindOverloadsDlg, + CleanDirDlg, CodeContextForm, AboutFrm, CompatibilityRestrictions, + RestrictionBrowser, ProjectWizardDlg, IDECmdLine, CodeExplOpts, // main ide MainBar, MainIntf, MainBase; @@ -273,6 +273,7 @@ type procedure mnuViewComponentPaletteClicked(Sender: TObject); procedure mnuViewIDESpeedButtonsClicked(Sender: TObject); procedure mnuViewFPCInfoClicked(Sender: TObject); + procedure mnuViewIDEInfoClicked(Sender: TObject); // project menu procedure mnuNewProjectClicked(Sender: TObject); @@ -2433,6 +2434,7 @@ begin itmViewIDESpeedButtons.OnClick := @mnuViewIDESpeedButtonsClicked; itmViewFPCInfo.OnClick:=@mnuViewFPCInfoClicked; + itmViewIDEInfo.OnClick:=@mnuViewIDEInfoClicked; end; end; @@ -2575,6 +2577,11 @@ begin ShowFPCInfo; end; +procedure TMainIDE.mnuViewIDEInfoClicked(Sender: TObject); +begin + ShowIDEInfo; +end; + procedure TMainIDE.SetDesigning(AComponent: TComponent; Value: Boolean); begin SetComponentDesignMode(AComponent, Value); diff --git a/ide/mainbar.pas b/ide/mainbar.pas index fa9916a76b..cc1e872ca5 100644 --- a/ide/mainbar.pas +++ b/ide/mainbar.pas @@ -223,6 +223,7 @@ type //itmViewIDEInternalsWindows: TIDEMenuSection; itmViewPackageLinks: TIDEMenuCommand; itmViewFPCInfo: TIDEMenuCommand; + itmViewIDEInfo: TIDEMenuCommand; // project menu //mnuProject: TIDEMenuSection; diff --git a/ide/mainbase.pas b/ide/mainbase.pas index d7bf4e1fc9..71532e4959 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -590,6 +590,7 @@ begin begin CreateMenuItem(itmViewIDEInternalsWindows, itmViewPackageLinks, 'itmViewPackageLinks', lisMenuPackageLinks); CreateMenuItem(itmViewIDEInternalsWindows, itmViewFPCInfo, 'itmViewFPCInfo', lisMenuAboutFPC); + CreateMenuItem(itmViewIDEInternalsWindows, itmViewIDEInfo, 'itmViewIDEInfo', lisAboutIDE); end; end; end;