IDE: added dialog: View / IDE internals / modified items

git-svn-id: trunk@34686 -
This commit is contained in:
mattias 2012-01-09 16:50:06 +00:00
parent 5c78a96a5e
commit d56af331dd
8 changed files with 207 additions and 9 deletions

2
.gitattributes vendored
View File

@ -4272,6 +4272,8 @@ ide/idehelpmanager.pas svneol=native#text/pascal
ide/ideinfodlg.lfm svneol=native#text/plain
ide/ideinfodlg.pas svneol=native#text/plain
ide/ideminilibc.pas svneol=native#text/plain
ide/idemodifiedinfo.lfm svneol=native#text/plain
ide/idemodifiedinfo.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

41
ide/idemodifiedinfo.lfm Normal file
View File

@ -0,0 +1,41 @@
object IDEModifiedInfoDialog: TIDEModifiedInfoDialog
Left = 275
Height = 450
Top = 250
Width = 704
Caption = 'IDEModifiedInfoDialog'
ClientHeight = 450
ClientWidth = 704
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.31'
object PageControl1: TPageControl
Left = 0
Height = 450
Top = 0
Width = 704
ActivePage = ProjectTabSheet
Align = alClient
TabIndex = 0
TabOrder = 0
object ProjectTabSheet: TTabSheet
Caption = 'Project'
ClientHeight = 414
ClientWidth = 696
object ProjectMemo: TMemo
Left = 0
Height = 414
Top = 0
Width = 696
Align = alClient
Lines.Strings = (
'ValuesMemo'
''
)
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 0
end
end
end
end

141
ide/idemodifiedinfo.pas Normal file
View File

@ -0,0 +1,141 @@
{
***************************************************************************
* *
* 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 <http://www.gnu.org/copyleft/gpl.html>. 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 what is modified.
}
unit IDEModifiedInfo;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ComCtrls, Project, SourceEditor;
type
{ TIDEModifiedInfoDialog }
TIDEModifiedInfoDialog = class(TForm)
ProjectMemo: TMemo;
PageControl1: TPageControl;
ProjectTabSheet: TTabSheet;
procedure FormCreate(Sender: TObject);
private
procedure UpdateProjectMemo;
procedure GatherProject(AProject: TProject; sl: TStrings);
public
end;
function ShowIDEModifiedInfo: TModalResult;
implementation
function ShowIDEModifiedInfo: TModalResult;
var
Dlg: TIDEModifiedInfoDialog;
begin
Dlg:=TIDEModifiedInfoDialog.Create(nil);
try
Result:=Dlg.ShowModal;
finally
Dlg.Free;
end;
end;
{$R *.lfm}
{ TIDEModifiedInfoDialog }
procedure TIDEModifiedInfoDialog.FormCreate(Sender: TObject);
begin
Caption:='Modified items in IDE';
UpdateProjectMemo;
PageControl1.PageIndex:=0;
end;
procedure TIDEModifiedInfoDialog.UpdateProjectMemo;
var
sl: TStringList;
begin
sl:=TStringList.Create;
try
GatherProject(Project1,sl);
ProjectMemo.Lines.Assign(sl);
finally
sl.Free;
end;
end;
procedure TIDEModifiedInfoDialog.GatherProject(AProject: TProject; sl: TStrings
);
var
aFile: TUnitInfo;
HeaderWritten: Boolean;
s: String;
begin
// summary
if AProject.Modified then
sl.Add('Project.Modified');
if AProject.SessionModified then
sl.Add('Project.SessionModified');
if Project1.SomethingModified(true,false) then
sl.Add('Project.SomethingModified Data');
if Project1.SomethingModified(false,true) then
sl.Add('Project.SomethingModified Session');
if SourceEditorManager.SomethingModified(false) then
sl.Add('SourceEditorManager.SomethingModified');
if AProject.BuildModes.IsModified(false) then
sl.Add('Project.BuildModes.IsModified data');
if AProject.BuildModes.IsModified(true) then
sl.Add('Project.BuildModes.IsModified session');
// details
HeaderWritten:=false;
aFile:=AProject.FirstPartOfProject;
while aFile<>nil do begin
if aFile.Modified or aFile.SessionModified
or ((aFile.Source<>nil) and aFile.Source.Modified)
then begin
if not HeaderWritten then begin
sl.Add('');
sl.Add('Project units:');
s:=aFile.GetShortFilename(true);
if aFile.Modified then
s:=s+' Modified';
if aFile.SessionModified then
s:=s+' SessionModified';
if (aFile.Source<>nil) and (aFile.Source.Modified) then
s:=s+' Source.Modified';
sl.Add(s);
end;
end;
aFile:=aFile.NextPartOfProject;
end;
end;
end.

View File

@ -308,7 +308,8 @@ resourcestring
lisMenuPackageLinks = 'Package Links ...';
lisMenuAboutFPC = 'About FPC';
lisAboutIDE = 'About IDE';
lisAboutModifiedItemsInTheIDE = 'About modified items in the IDE';
lisMenuNewProject = 'New Project ...';
lisMenuNewProjectFromFile = 'New Project from File ...';
lisMenuOpenProject = 'Open Project ...';

View File

@ -145,10 +145,11 @@ uses
OutputFilter, JumpHistoryView, ManageExamples,
BuildLazDialog, BuildProfileManager, BuildManager, CheckCompOptsForNewUnitDlg,
MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
IDEFPCInfo, IDEInfoDlg, ProcessList, InitialSetupDlgs, NewDialog,
MakeResStrDlg, DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer,
BuildFileDlg, ProcedureList, ExtractProcDlg, FindRenameIdentifier,
AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, UseUnitDlg, FindOverloadsDlg,
IDEFPCInfo, IDEInfoDlg, IDEModifiedInfo, ProcessList, InitialSetupDlgs,
NewDialog, MakeResStrDlg, DialogProcs, FindReplaceDialog, FindInFilesDlg,
CodeExplorer, BuildFileDlg, ProcedureList, ExtractProcDlg,
FindRenameIdentifier, AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg,
UseUnitDlg, FindOverloadsDlg,
CleanDirDlg, CodeContextForm, AboutFrm, CompatibilityRestrictions,
RestrictionBrowser, ProjectWizardDlg, IDECmdLine, IDEGuiCmdLine, CodeExplOpts,
// main ide
@ -259,6 +260,7 @@ type
procedure mnuViewIDESpeedButtonsClicked(Sender: TObject);
procedure mnuViewFPCInfoClicked(Sender: TObject);
procedure mnuViewIDEInfoClicked(Sender: TObject);
procedure mnuViewIDEModifiedInfoClicked(Sender: TObject);
// source menu
procedure mnuSourceClicked(Sender: TObject);
@ -2525,6 +2527,7 @@ begin
itmViewFPCInfo.OnClick:=@mnuViewFPCInfoClicked;
itmViewIDEInfo.OnClick:=@mnuViewIDEInfoClicked;
itmViewIDEModifiedInfo.OnClick:=@mnuViewIDEModifiedInfoClicked;
end;
end;
@ -2722,6 +2725,11 @@ begin
ShowIDEInfo;
end;
procedure TMainIDE.mnuViewIDEModifiedInfoClicked(Sender: TObject);
begin
ShowIDEModifiedInfo;
end;
procedure TMainIDE.SetDesigning(AComponent: TComponent; Value: Boolean);
begin
SetComponentDesignMode(AComponent, Value);

View File

@ -197,6 +197,7 @@ type
itmViewPackageLinks: TIDEMenuCommand;
itmViewFPCInfo: TIDEMenuCommand;
itmViewIDEInfo: TIDEMenuCommand;
itmViewIDEModifiedInfo: TIDEMenuCommand;
// source menu
//mnuSource: TIDEMenuSection;

View File

@ -538,6 +538,7 @@ begin
CreateMenuItem(itmViewIDEInternalsWindows, itmViewPackageLinks, 'itmViewPackageLinks', lisMenuPackageLinks);
CreateMenuItem(itmViewIDEInternalsWindows, itmViewFPCInfo, 'itmViewFPCInfo', lisMenuAboutFPC);
CreateMenuItem(itmViewIDEInternalsWindows, itmViewIDEInfo, 'itmViewIDEInfo', lisAboutIDE);
CreateMenuItem(itmViewIDEInternalsWindows, itmViewIDEModifiedInfo, 'itmViewIDEModifiedInfo', lisAboutModifiedItemsInTheIDE);
end;
end;
end;

View File

@ -5293,7 +5293,7 @@ end;
function TProject.SomeDataModified(Verbose: boolean): boolean;
var
i: Integer;
AnUnitInfo: TUnitInfo;
begin
Result:=true;
if Modified then
@ -5308,13 +5308,16 @@ begin
DebugLn(['TProject.SomeDataModified CompilerOptions/BuildModes']);
Exit;
end;
for i := 0 to UnitCount - 1 do
if (Units[i].IsPartOfProject) and Units[i].Modified then
AnUnitInfo:=FirstPartOfProject;
while AnUnitInfo<>nil do begin
if AnUnitInfo.Modified then
begin
if Verbose then
DebugLn('TProject.SomeDataModified PartOfProject ',Units[i].Filename);
DebugLn('TProject.SomeDataModified PartOfProject ',AnUnitInfo.Filename);
Exit;
end;
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
end;
Result:=false;
end;