mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 04:39:36 +02:00
IDE: orphaned ppu: delete button
git-svn-id: trunk@48092 -
This commit is contained in:
parent
6399902356
commit
aa72b32e77
@ -343,7 +343,7 @@ end;
|
||||
|
||||
destructor TAddFileToAPackageDialog.Destroy;
|
||||
begin
|
||||
fPackages.Free;
|
||||
FreeAndNil(fPackages);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
@ -3,19 +3,19 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
Height = 578
|
||||
Top = 216
|
||||
Width = 607
|
||||
ActiveControl = AvailableFilterEdit
|
||||
BorderStyle = bsSizeToolWin
|
||||
Caption = 'InstallPkgSetDialog'
|
||||
ClientHeight = 578
|
||||
ClientWidth = 607
|
||||
Constraints.MinHeight = 400
|
||||
Constraints.MinWidth = 450
|
||||
OnClose = FormClose
|
||||
OnCreate = InstallPkgSetDialogCreate
|
||||
OnDestroy = InstallPkgSetDialogDestroy
|
||||
OnResize = InstallPkgSetDialogResize
|
||||
OnShow = InstallPkgSetDialogShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.5'
|
||||
object InstallPkgGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = NoteLabel
|
||||
@ -23,7 +23,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
AnchorSideRight.Control = lblMiddle
|
||||
AnchorSideBottom.Control = PkgInfoGroupBox
|
||||
Left = 6
|
||||
Height = 373
|
||||
Height = 378
|
||||
Top = 27
|
||||
Width = 294
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -32,13 +32,13 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
BorderSpacing.Right = 3
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'InstallPkgGroupBox'
|
||||
ClientHeight = 354
|
||||
ClientHeight = 361
|
||||
ClientWidth = 290
|
||||
TabOrder = 0
|
||||
object ImportButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 292
|
||||
Top = 299
|
||||
Width = 278
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -49,7 +49,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object ExportButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 323
|
||||
Top = 330
|
||||
Width = 278
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -61,7 +61,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
AnchorSideTop.Control = InstalledFilterEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 227
|
||||
Height = 234
|
||||
Top = 28
|
||||
Width = 278
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -81,7 +81,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object UninstallButton: TBitBtn
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 261
|
||||
Top = 268
|
||||
Width = 278
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -92,7 +92,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object InstalledFilterEdit: TTreeFilterEdit
|
||||
AnchorSideTop.Control = InstallPkgGroupBox
|
||||
Left = 8
|
||||
Height = 28
|
||||
Height = 25
|
||||
Top = 3
|
||||
Width = 276
|
||||
ButtonWidth = 23
|
||||
@ -115,7 +115,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = PkgInfoGroupBox
|
||||
Left = 306
|
||||
Height = 373
|
||||
Height = 378
|
||||
Top = 27
|
||||
Width = 295
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -124,14 +124,14 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'AvailablePkgGroupBox'
|
||||
ClientHeight = 354
|
||||
ClientHeight = 361
|
||||
ClientWidth = 291
|
||||
TabOrder = 1
|
||||
object AvailableTreeView: TTreeView
|
||||
AnchorSideTop.Control = AvailableFilterEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 289
|
||||
Height = 296
|
||||
Top = 28
|
||||
Width = 279
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -154,7 +154,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object AddToInstallButton: TBitBtn
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 323
|
||||
Top = 330
|
||||
Width = 279
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -165,7 +165,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object AvailableFilterEdit: TTreeFilterEdit
|
||||
AnchorSideTop.Control = AvailablePkgGroupBox
|
||||
Left = 6
|
||||
Height = 28
|
||||
Height = 25
|
||||
Top = 3
|
||||
Width = 279
|
||||
ButtonWidth = 23
|
||||
@ -183,16 +183,16 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
AnchorSideBottom.Control = BtnPanel
|
||||
Left = 0
|
||||
Height = 127
|
||||
Top = 406
|
||||
Top = 411
|
||||
Width = 607
|
||||
Align = alBottom
|
||||
Caption = 'PkgInfoGroupBox'
|
||||
ClientHeight = 108
|
||||
ClientHeight = 110
|
||||
ClientWidth = 603
|
||||
TabOrder = 2
|
||||
object PkgInfoMemo: TMemo
|
||||
Left = 6
|
||||
Height = 96
|
||||
Height = 98
|
||||
Top = 6
|
||||
Width = 591
|
||||
Align = alClient
|
||||
@ -204,20 +204,20 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
end
|
||||
object BtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 45
|
||||
Top = 533
|
||||
Height = 40
|
||||
Top = 538
|
||||
Width = 607
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 45
|
||||
ClientHeight = 40
|
||||
ClientWidth = 607
|
||||
TabOrder = 3
|
||||
object HelpButton: TBitBtn
|
||||
Left = 6
|
||||
Height = 33
|
||||
Height = 28
|
||||
Top = 6
|
||||
Width = 76
|
||||
Width = 75
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -228,10 +228,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
TabOrder = 0
|
||||
end
|
||||
object CancelButton: TBitBtn
|
||||
Left = 156
|
||||
Height = 33
|
||||
Left = 215
|
||||
Height = 28
|
||||
Top = 6
|
||||
Width = 90
|
||||
Width = 75
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -243,10 +243,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
TabOrder = 1
|
||||
end
|
||||
object SaveAndExitButton: TBitBtn
|
||||
Left = 441
|
||||
Height = 33
|
||||
Left = 462
|
||||
Height = 28
|
||||
Top = 6
|
||||
Width = 160
|
||||
Width = 139
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -292,10 +292,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
TabOrder = 3
|
||||
end
|
||||
object SaveAndRebuildButton: TBitBtn
|
||||
Left = 252
|
||||
Height = 33
|
||||
Left = 296
|
||||
Height = 28
|
||||
Top = 6
|
||||
Width = 183
|
||||
Width = 160
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
|
@ -41,9 +41,9 @@ uses
|
||||
KeywordFuncLists, BasicCodeTools, StdCtrls, Buttons, FileUtil, ExtCtrls,
|
||||
ComCtrls, EditBtn, LCLType, ImgList, AvgLvlTree, Laz2_XMLCfg, LazUTF8,
|
||||
LazFileUtils, TreeFilterEdit, PackageIntf, IDEImagesIntf, IDEHelpIntf,
|
||||
IDEDialogs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory, LazConf,
|
||||
IDEProcs, PackageDefs, PackageSystem, PackageLinks, IDEContextHelpEdit,
|
||||
LPKCache;
|
||||
IDEDialogs, IDEWindowIntf, LazarusIDEStrConsts, EnvironmentOpts, InputHistory,
|
||||
LazConf, IDEProcs, PackageDefs, PackageSystem, PackageLinks,
|
||||
IDEContextHelpEdit, LPKCache;
|
||||
|
||||
type
|
||||
TOnCheckInstallPackageList =
|
||||
@ -75,6 +75,7 @@ type
|
||||
procedure AddToInstallButtonClick(Sender: TObject);
|
||||
function FilterEditGetImageIndex(Str: String; Data: TObject;
|
||||
var AIsEnabled: Boolean): Integer;
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure InstallTreeViewKeyPress(Sender: TObject; var Key: char);
|
||||
procedure LPKParsingTimerTimer(Sender: TObject);
|
||||
procedure OnAllLPKParsed(Sender: TObject);
|
||||
@ -185,6 +186,8 @@ end;
|
||||
|
||||
procedure TInstallPkgSetDialog.InstallPkgSetDialogCreate(Sender: TObject);
|
||||
begin
|
||||
IDEDialogLayoutList.ApplyLayout(Self,Width,Height);
|
||||
|
||||
InstallTreeView.Images := IDEImages.Images_16;
|
||||
AvailableTreeView.Images := IDEImages.Images_16;
|
||||
ImgIndexPackage := IDEImages.LoadImage(16, 'item_package');
|
||||
@ -319,6 +322,12 @@ begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
IDEDialogLayoutList.SaveLayout(Self);
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.InstallTreeViewKeyPress(Sender: TObject; var Key: char);
|
||||
begin
|
||||
if Key = char(VK_RETURN) then
|
||||
|
@ -5,6 +5,8 @@ object PGIPConflictsDialog: TPGIPConflictsDialog
|
||||
Width = 469
|
||||
ClientHeight = 424
|
||||
ClientWidth = 469
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
object ButtonPanel1: TButtonPanel
|
||||
@ -33,10 +35,16 @@ object PGIPConflictsDialog: TPGIPConflictsDialog
|
||||
DefaultItemHeight = 18
|
||||
ReadOnly = True
|
||||
TabOrder = 1
|
||||
OnAdvancedCustomDrawItem = ConflictsTreeViewAdvancedCustomDrawItem
|
||||
OnMouseDown = ConflictsTreeViewMouseDown
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||
end
|
||||
object IDEDialogLayoutStorage1: TIDEDialogLayoutStorage
|
||||
left = 161
|
||||
top = 104
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
left = 290
|
||||
top = 104
|
||||
end
|
||||
end
|
||||
|
@ -25,9 +25,10 @@
|
||||
Check source files and compiled files for name conflicts between packages.
|
||||
|
||||
ToDo:
|
||||
- allow to delete ppu files
|
||||
- save ignore
|
||||
- don't check when building clean
|
||||
- save ignore date for ?
|
||||
- ignore
|
||||
- clear ignore date on clean build
|
||||
}
|
||||
unit InterPkgConflictFiles;
|
||||
|
||||
@ -36,14 +37,14 @@ unit InterPkgConflictFiles;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, contnrs, InterfaceBase, Forms, ComCtrls,
|
||||
Controls, ButtonPanel, FileProcs, LazFileUtils, AvgLvlTree, BasicCodeTools,
|
||||
DefineTemplates, CodeToolManager,
|
||||
Classes, SysUtils, types, math, contnrs, InterfaceBase, Forms, ComCtrls,
|
||||
Controls, ButtonPanel, Themes, Graphics, StdCtrls, Buttons, FileProcs,
|
||||
LazFileUtils, AvgLvlTree, BasicCodeTools, DefineTemplates, CodeToolManager,
|
||||
// IDEIntf
|
||||
ProjectIntf, CompOptsIntf, IDEWindowIntf, LazIDEIntf,
|
||||
ProjectIntf, CompOptsIntf, IDEWindowIntf, LazIDEIntf, IDEImagesIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, CompilerOptions, EnvironmentOpts, IDEProcs,
|
||||
TransferMacros, LazConf, IDECmdLine, PackageDefs, PackageSystem;
|
||||
LazarusIDEStrConsts, CompilerOptions, EnvironmentOpts, IDEProcs, DialogProcs,
|
||||
TransferMacros, LazConf, IDECmdLine, PackageDefs, PackageSystem, InputHistory;
|
||||
|
||||
type
|
||||
TPGInterPkgOwnerInfo = class
|
||||
@ -95,6 +96,23 @@ type
|
||||
ButtonPanel1: TButtonPanel;
|
||||
ConflictsTreeView: TTreeView;
|
||||
IDEDialogLayoutStorage1: TIDEDialogLayoutStorage;
|
||||
ImageList1: TImageList;
|
||||
procedure ConflictsTreeViewAdvancedCustomDrawItem(Sender: TCustomTreeView;
|
||||
Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage;
|
||||
var PaintImages, DefaultDraw: Boolean);
|
||||
procedure ConflictsTreeViewMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure DeleteSelectedFilesButtonClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure OkButtonClick(Sender: TObject);
|
||||
private
|
||||
DeleteSelectedFilesButton: TButton;
|
||||
FImgIndexChecked: integer;
|
||||
FImgIndexUnchecked: integer;
|
||||
procedure UpdateButtons;
|
||||
procedure IgnoreConflicts;
|
||||
procedure IgnoreConflict(AmbFile: TPGIPAmbiguousFile);
|
||||
public
|
||||
SrcFiles: TObjectList; // list of TPGIPAmbiguousFile
|
||||
CompiledFiles: TObjectList; // list of TPGIPAmbiguousCompiledFile
|
||||
@ -155,6 +173,244 @@ begin
|
||||
o:=OwnerInfo; OwnerInfo:=ConflictOwner; ConflictOwner:=o;
|
||||
end;
|
||||
|
||||
{ TPGIPConflictsDialog }
|
||||
|
||||
procedure TPGIPConflictsDialog.ConflictsTreeViewAdvancedCustomDrawItem(
|
||||
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
||||
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
||||
var
|
||||
Detail: TThemedButton;
|
||||
Details: TThemedElementDetails;
|
||||
aSize: TSize;
|
||||
NodeRect: Classes.TRect;
|
||||
r: TRect;
|
||||
begin
|
||||
if Stage<>cdPostPaint then exit;
|
||||
if TObject(Node.Data) is TPGIPAmbiguousFile then begin
|
||||
if Node.ImageIndex=FImgIndexChecked then
|
||||
Detail := tbCheckBoxCheckedNormal
|
||||
else
|
||||
Detail := tbCheckBoxUncheckedNormal;
|
||||
Details := ThemeServices.GetElementDetails(Detail);
|
||||
aSize := ThemeServices.GetDetailSize(Details);
|
||||
NodeRect:=Node.DisplayRect(false);
|
||||
r:=Bounds(Node.DisplayIconLeft+(ImageList1.Width-aSize.cx) div 2,
|
||||
NodeRect.Top+(NodeRect.Bottom-NodeRect.Top-aSize.cy) div 2,
|
||||
aSize.cx,aSize.cy);
|
||||
ThemeServices.DrawElement(ConflictsTreeView.Canvas.Handle,Details,r);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.ConflictsTreeViewMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
Node:=ConflictsTreeView.GetNodeAt(X,Y);
|
||||
if Node=nil then exit;
|
||||
if TObject(Node.Data) is TPGIPAmbiguousFile then begin
|
||||
if (X>=Node.DisplayIconLeft) and (X<Node.DisplayTextLeft) then begin
|
||||
if Node.ImageIndex=FImgIndexChecked then
|
||||
Node.ImageIndex:=FImgIndexUnchecked
|
||||
else
|
||||
Node.ImageIndex:=FImgIndexChecked;
|
||||
Node.SelectedIndex:=Node.ImageIndex;
|
||||
UpdateButtons;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.DeleteSelectedFilesButtonClick(Sender: TObject);
|
||||
|
||||
function DeleteFileGroup(aFilename: string): boolean;
|
||||
begin
|
||||
{$IFDEF VerboseCheckInterPkgFiles}
|
||||
debugln(['DeleteFileGroup ',aFilename]);
|
||||
{$ENDIF}
|
||||
if DeleteFileInteractive(aFilename)<>mrOk then exit(false);
|
||||
if FilenameIsPascalUnit(aFilename) then
|
||||
begin
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.ppu'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.o'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.rst'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.rsj'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.lfm'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.dfm'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.xfm'));
|
||||
end else if (CompareFileExt(aFilename,'ppu')=0)
|
||||
or (CompareFileExt(aFilename,'o')=0) then begin
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.ppu'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.o'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.rst'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.rsj'));
|
||||
if FileExistsCached(ChangeFileExt(aFilename,'.pas'))
|
||||
or FileExistsCached(ChangeFileExt(aFilename,'.pp'))
|
||||
or FileExistsCached(ChangeFileExt(aFilename,'.p')) then begin
|
||||
// delete only compiled file
|
||||
end else begin
|
||||
// no source in this directory => delete copied lfm file
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.lfm'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.dfm'));
|
||||
DeleteFileUTF8(ChangeFileExt(aFilename,'.xfm'));
|
||||
end;
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
var
|
||||
Node: TTreeNode;
|
||||
AmbFile: TPGIPAmbiguousFile;
|
||||
LastAmbFile: TPGIPAmbiguousFile;
|
||||
NextNode: TTreeNode;
|
||||
DeleteFile1: Boolean;
|
||||
DeleteFile2: Boolean;
|
||||
begin
|
||||
ConflictsTreeView.Items.BeginUpdate;
|
||||
try
|
||||
Node:=ConflictsTreeView.Items.GetFirstNode;
|
||||
LastAmbFile:=nil;
|
||||
while Node<>nil do
|
||||
begin
|
||||
NextNode:=Node.GetNext;
|
||||
if TObject(Node.Data) is TPGIPAmbiguousFile then
|
||||
begin
|
||||
AmbFile:=TPGIPAmbiguousFile(Node.Data);
|
||||
{$IFDEF VerboseCheckInterPkgFiles}
|
||||
debugln(['TPGIPConflictsDialog.DeleteSelectedFilesButtonClick ',Node.Text,' File=',AmbFile.Filename]);
|
||||
{$ENDIF}
|
||||
if AmbFile<>LastAmbFile then
|
||||
begin
|
||||
DeleteFile1:=Node.ImageIndex=FImgIndexChecked;
|
||||
DeleteFile2:=false;
|
||||
end else begin
|
||||
DeleteFile2:=Node.ImageIndex=FImgIndexChecked;
|
||||
{$IFDEF VerboseCheckInterPkgFiles}
|
||||
debugln(['TPGIPConflictsDialog.DeleteSelectedFilesButtonClick Delete 1=',DeleteFile1,' 2=',DeleteFile2]);
|
||||
{$ENDIF}
|
||||
if DeleteFile1 then
|
||||
if not DeleteFileGroup(AmbFile.Filename) then exit;
|
||||
if DeleteFile2 then
|
||||
if not DeleteFileGroup(AmbFile.ConflictFilename) then exit;
|
||||
if not FileExistsUTF8(AmbFile.Filename)
|
||||
or not FileExistsUTF8(AmbFile.ConflictFilename) then begin
|
||||
// conflict does not exist anymore
|
||||
FilesChanged:=true;
|
||||
Node:=Node.Parent;
|
||||
NextNode:=Node.GetNextSkipChildren;
|
||||
Node.Delete;
|
||||
end;
|
||||
end;
|
||||
LastAmbFile:=AmbFile;
|
||||
end;
|
||||
Node:=NextNode;
|
||||
end;
|
||||
finally
|
||||
ConflictsTreeView.Items.EndUpdate;
|
||||
UpdateButtons;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
IDEDialogLayoutList.SaveLayout(Self);
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.FormCreate(Sender: TObject);
|
||||
var
|
||||
Details: TThemedElementDetails;
|
||||
aSize: TSize;
|
||||
Img: TBitmap;
|
||||
begin
|
||||
IDEDialogLayoutList.ApplyLayout(Self,Width,Height);
|
||||
|
||||
DeleteSelectedFilesButton:=TButton.Create(Self);
|
||||
with DeleteSelectedFilesButton do
|
||||
begin
|
||||
Name:='DeleteSelectedFilesButton';
|
||||
Caption:='Delete selected files';
|
||||
Align:=alLeft;
|
||||
AutoSize:=true;
|
||||
OnClick:=@DeleteSelectedFilesButtonClick;
|
||||
Parent:=ButtonPanel1;
|
||||
end;
|
||||
|
||||
ButtonPanel1.OKButton.Kind:=bkIgnore;
|
||||
ButtonPanel1.OKButton.Caption:='Ignore';
|
||||
ButtonPanel1.OKButton.OnClick:=@OkButtonClick;
|
||||
|
||||
Details := ThemeServices.GetElementDetails(tbCheckBoxCheckedNormal);
|
||||
aSize := ThemeServices.GetDetailSize(Details);
|
||||
ImageList1.Width:=Max(16,aSize.cx);
|
||||
ImageList1.Height:=Max(16,aSize.cy);
|
||||
// add empty images
|
||||
Img:=TBitmap.Create;
|
||||
Img.TransparentMode:=tmFixed;
|
||||
Img.TransparentColor:=0;
|
||||
Img.Transparent:=true;
|
||||
Img.SetSize(ImageList1.Width,ImageList1.Height);
|
||||
FImgIndexChecked:=ImageList1.Add(Img,nil);
|
||||
FImgIndexUnchecked:=ImageList1.Add(Img,nil);
|
||||
Img.Free;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.OkButtonClick(Sender: TObject);
|
||||
begin
|
||||
IgnoreConflicts;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.UpdateButtons;
|
||||
var
|
||||
Node: TTreeNode;
|
||||
DeleteCount: Integer;
|
||||
ConflictCount: Integer;
|
||||
begin
|
||||
DeleteCount:=0;
|
||||
ConflictCount:=0;
|
||||
Node:=ConflictsTreeView.Items.GetFirstNode;
|
||||
while Node<>nil do begin
|
||||
if TObject(Node.Data) is TPGIPAmbiguousFile then
|
||||
begin
|
||||
inc(ConflictCount);
|
||||
if Node.ImageIndex=FImgIndexChecked then
|
||||
inc(DeleteCount);
|
||||
end;
|
||||
Node:=Node.GetNext;
|
||||
end;
|
||||
DeleteSelectedFilesButton.Enabled:=DeleteCount>0;
|
||||
if ConflictCount=0 then
|
||||
IgnoreConflicts;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.IgnoreConflicts;
|
||||
var
|
||||
Node: TTreeNode;
|
||||
AmbFile: TPGIPAmbiguousFile;
|
||||
LastAmbFile: TPGIPAmbiguousFile;
|
||||
begin
|
||||
Node:=ConflictsTreeView.Items.GetFirstNode;
|
||||
LastAmbFile:=nil;
|
||||
while Node<>nil do begin
|
||||
if TObject(Node.Data) is TPGIPAmbiguousFile then
|
||||
begin
|
||||
AmbFile:=TPGIPAmbiguousFile(Node.Data);
|
||||
if AmbFile<>LastAmbFile then begin
|
||||
IgnoreConflict(AmbFile);
|
||||
end;
|
||||
LastAmbFile:=AmbFile;
|
||||
end;
|
||||
Node:=Node.GetNext;
|
||||
end;
|
||||
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.IgnoreConflict(AmbFile: TPGIPAmbiguousFile);
|
||||
begin
|
||||
|
||||
//InputHistories.Ignores.Add(Identifier);
|
||||
end;
|
||||
|
||||
procedure TPGIPConflictsDialog.Init(TheSrcFiles, TheCompiledFiles: TObjectList);
|
||||
|
||||
function AddChild(ParentNode: TTreeNode; Caption: string): TTreeNode;
|
||||
@ -165,56 +421,79 @@ procedure TPGIPConflictsDialog.Init(TheSrcFiles, TheCompiledFiles: TObjectList);
|
||||
var
|
||||
MainNode: TTreeNode;
|
||||
i: Integer;
|
||||
CurFile: TPGIPAmbiguousCompiledFile;
|
||||
AmbFile: TPGIPAmbiguousCompiledFile;
|
||||
ItemNode: TTreeNode;
|
||||
s: String;
|
||||
ConflictNode: TTreeNode;
|
||||
begin
|
||||
SrcFiles:=TheSrcFiles;
|
||||
CompiledFiles:=TheCompiledFiles;
|
||||
|
||||
ConflictsTreeView.Items.BeginUpdate;
|
||||
ConflictsTreeView.Items.Clear;
|
||||
ConflictsTreeView.Images:=ImageList1;
|
||||
if CompiledFiles.Count>0 then
|
||||
begin
|
||||
MainNode:=ConflictsTreeView.Items.Add(nil,'Conflicting compiled files');
|
||||
for i:=0 to CompiledFiles.Count-1 do
|
||||
begin
|
||||
CurFile:=TPGIPAmbiguousCompiledFile(CompiledFiles[i]);
|
||||
s:=ExtractFilename(CurFile.Filename);
|
||||
// file owner
|
||||
if CurFile.OwnerInfo.Owner is TLazPackage then
|
||||
s+=' of package '+CurFile.OwnerInfo.Name
|
||||
else
|
||||
s+=' of '+CurFile.OwnerInfo.Name;
|
||||
ItemNode:=AddChild(MainNode,s);
|
||||
// file path and src
|
||||
AddChild(ItemNode,'File: '+CurFile.Filename);
|
||||
if CurFile.SrcFilename='' then
|
||||
s:='No source found'
|
||||
else
|
||||
s:='Source file: '+CurFile.SrcFilename;
|
||||
AddChild(ItemNode,s);
|
||||
|
||||
// conflict file owner
|
||||
if CurFile.ConflictOwner.Owner is TLazPackage then
|
||||
s:='Conflict Package: '+CurFile.ConflictOwner.Name
|
||||
else
|
||||
s:=CurFile.ConflictOwner.Name;
|
||||
AddChild(ItemNode,s);
|
||||
// conflict file path
|
||||
AddChild(ItemNode,'Conflict File: '+CurFile.ConflictFilename);
|
||||
if not FilenameIsPascalSource(CurFile.ConflictFilename) then begin
|
||||
if CurFile.ConflictSrcFilename='' then
|
||||
s:='No source found'
|
||||
AmbFile:=TPGIPAmbiguousCompiledFile(CompiledFiles[i]);
|
||||
s:=ExtractFilename(AmbFile.Filename);
|
||||
ConflictNode:=AddChild(MainNode,s);
|
||||
begin
|
||||
// first file
|
||||
s:=ExtractFilename(AmbFile.Filename);
|
||||
if AmbFile.OwnerInfo.Owner is TLazPackage then
|
||||
s+=' of package '+AmbFile.OwnerInfo.Name
|
||||
else
|
||||
s:='Source file: '+CurFile.ConflictSrcFilename;
|
||||
AddChild(ItemNode,s);
|
||||
s+=' of '+AmbFile.OwnerInfo.Name;
|
||||
ItemNode:=AddChild(ConflictNode,s);
|
||||
ItemNode.ImageIndex:=FImgIndexChecked; // default: delete
|
||||
ItemNode.Data:=AmbFile;
|
||||
begin
|
||||
// file path and src
|
||||
AddChild(ItemNode,'File: '+AmbFile.Filename);
|
||||
if not FilenameIsPascalSource(AmbFile.Filename) then begin
|
||||
if AmbFile.SrcFilename='' then
|
||||
s:='No source found'
|
||||
else
|
||||
s:='Source file: '+AmbFile.SrcFilename;
|
||||
AddChild(ItemNode,s);
|
||||
end;
|
||||
end;
|
||||
ItemNode.SelectedIndex:=ItemNode.ImageIndex;
|
||||
|
||||
// conflict file owner
|
||||
s:=ExtractFilename(AmbFile.ConflictFilename);
|
||||
if AmbFile.ConflictOwner.Owner is TLazPackage then
|
||||
s+=' of package '+AmbFile.ConflictOwner.Name
|
||||
else
|
||||
s+=' of '+AmbFile.ConflictOwner.Name;
|
||||
ItemNode:=AddChild(ConflictNode,s);
|
||||
ItemNode.ImageIndex:=FImgIndexUnchecked; // default: keep
|
||||
ItemNode.Data:=AmbFile;
|
||||
begin
|
||||
// file path
|
||||
AddChild(ItemNode,'File: '+AmbFile.ConflictFilename);
|
||||
if not FilenameIsPascalSource(AmbFile.ConflictFilename) then begin
|
||||
if AmbFile.ConflictSrcFilename='' then begin
|
||||
s:='No source found';
|
||||
ItemNode.ImageIndex:=FImgIndexChecked; // default: delete
|
||||
end
|
||||
else
|
||||
s:='Source file: '+AmbFile.ConflictSrcFilename;
|
||||
AddChild(ItemNode,s);
|
||||
end;
|
||||
end;
|
||||
ItemNode.SelectedIndex:=ItemNode.ImageIndex;
|
||||
end;
|
||||
end;
|
||||
MainNode.Expand(true);
|
||||
end;
|
||||
|
||||
ConflictsTreeView.Items.EndUpdate;
|
||||
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
{ TPGInterPkgFile }
|
||||
|
Loading…
Reference in New Issue
Block a user