mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 11:01:20 +02:00
implemented renaming of new package files
git-svn-id: trunk@7339 -
This commit is contained in:
parent
b0f697e2fa
commit
384a57a132
@ -159,8 +159,8 @@ Type
|
||||
function GetSetElementValue(const AliasName: string): boolean;
|
||||
procedure SetSetElementValue(const AliasName: string; NewValue: boolean);
|
||||
function GetIndexOfSetElement(const AliasName: string): integer;
|
||||
function GetSetTypeData(var CompData: PTypeInfo;
|
||||
var TypeData: PTypeData): boolean;
|
||||
function GetSetTypeData(out CompData: PTypeInfo;
|
||||
out TypeData: PTypeData): boolean;
|
||||
public
|
||||
property AliasValues: TAliasStrings read FAliasValues;
|
||||
property CanModify: boolean read GetCanModify;
|
||||
@ -1931,8 +1931,8 @@ begin
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
function TCustomPropertyLink.GetSetTypeData(var CompData: PTypeInfo;
|
||||
var TypeData: PTypeData): boolean;
|
||||
function TCustomPropertyLink.GetSetTypeData(out CompData: PTypeInfo;
|
||||
out TypeData: PTypeData): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
CompData:=nil;
|
||||
|
@ -216,15 +216,15 @@ type
|
||||
procedure DrawObjectName(Index: integer; const aRect: TRect;
|
||||
aState: TGridDrawState);
|
||||
procedure GetCellEditor(aCol, aRow: integer;
|
||||
var PropEditor: TPropertyEditor;
|
||||
var IndependentEditor: boolean);
|
||||
out PropEditor: TPropertyEditor;
|
||||
out IndependentEditor: boolean);
|
||||
procedure FreeCellEditor(PropEditor: TPropertyEditor);
|
||||
function GridStateToPropEditState(GridState: TGridDrawState
|
||||
): TPropEditDrawState;
|
||||
function GetTIObject(Index: integer): TPersistent;
|
||||
procedure MapCell(aCol, aRow: integer;
|
||||
var ObjectIndex, PropertyIndex: integer;
|
||||
var CellType: TTIGridCellType);
|
||||
out ObjectIndex, PropertyIndex: integer;
|
||||
out CellType: TTIGridCellType);
|
||||
function GetCurrentGridProperty: TTIGridProperty;
|
||||
function IndexOfGridProperty(const PropName: string): integer;
|
||||
function FindGridProperty(const PropName: string): TTIGridProperty;
|
||||
@ -954,7 +954,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTICustomGrid.GetCellEditor(aCol, aRow: integer;
|
||||
var PropEditor: TPropertyEditor; var IndependentEditor: boolean);
|
||||
out PropEditor: TPropertyEditor; out IndependentEditor: boolean);
|
||||
var
|
||||
ObjectIndex: Integer;
|
||||
PropertyIndex: Integer;
|
||||
@ -1070,8 +1070,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTICustomGrid.MapCell(aCol, aRow: integer; var ObjectIndex,
|
||||
PropertyIndex: integer; var CellType: TTIGridCellType);
|
||||
procedure TTICustomGrid.MapCell(aCol, aRow: integer; out ObjectIndex,
|
||||
PropertyIndex: integer; out CellType: TTIGridCellType);
|
||||
var
|
||||
PropHeaderLines: LongInt;
|
||||
ObjectHeaderLines: LongInt;
|
||||
|
@ -4002,7 +4002,8 @@ begin
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// change packages containing the file
|
||||
Result:=PkgBoss.OnRenameFile(OldFilename,AnUnitInfo.Filename);
|
||||
Result:=PkgBoss.OnRenameFile(OldFilename,AnUnitInfo.Filename,
|
||||
AnUnitInfo.IsPartOfProject);
|
||||
if Result=mrAbort then exit;
|
||||
|
||||
// delete ambiguous files
|
||||
@ -11809,6 +11810,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.883 2005/07/13 07:33:14 mattias
|
||||
implemented renaming of new package files
|
||||
|
||||
Revision 1.882 2005/07/01 11:19:24 mattias
|
||||
converting lfm to bin stream: added END check for Delphi bug: it writes empty values
|
||||
|
||||
|
@ -46,7 +46,7 @@ uses
|
||||
Dialogs, Messages, Clistbox, ActnList, Grids, MaskEdit,
|
||||
Printers, PostScriptPrinter, PostScriptCanvas, CheckLst, PairSplitter,
|
||||
ExtDlgs, DBCtrls, DBGrids, DBActns, EditBtn, ExtGraphics,
|
||||
PropertyStorage, IniPropStorage, XMLPropStorage, Chart,
|
||||
PropertyStorage, IniPropStorage, XMLPropStorage, Chart, LDockTree,
|
||||
// widgetset skeleton
|
||||
WSActnList, WSArrow, WSButtons, WSCalendar,
|
||||
WSCheckLst, WSCListBox, WSComCtrls, WSControls,
|
||||
@ -67,6 +67,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.26 2005/07/13 07:33:14 mattias
|
||||
implemented renaming of new package files
|
||||
|
||||
Revision 1.25 2005/03/23 10:45:06 mattias
|
||||
fixed ambigious with ambiguous
|
||||
|
||||
|
@ -1736,6 +1736,7 @@ type
|
||||
function PrevVisible: TDockZone;
|
||||
procedure AddAsFirstChild(NewChildZone: TDockZone);
|
||||
procedure AddAsLastChild(NewChildZone: TDockZone);
|
||||
procedure ReplaceChild(OldChild, NewChild: TDockZone);
|
||||
function GetLastChild: TDockZone;
|
||||
public
|
||||
property ChildControl: TControl read FChildControl;
|
||||
@ -1869,6 +1870,7 @@ type
|
||||
procedure PaintDockFrame(ACanvas: TCanvas; AControl: TControl;
|
||||
const ARect: TRect); virtual;
|
||||
procedure UpdateAll;
|
||||
procedure SetDockZoneClass(const AValue: TDockZoneClass);
|
||||
public
|
||||
constructor Create(TheDockSite: TWinControl); virtual;
|
||||
destructor Destroy; override;
|
||||
@ -2951,6 +2953,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.309 2005/07/13 07:33:14 mattias
|
||||
implemented renaming of new package files
|
||||
|
||||
Revision 1.308 2005/07/09 16:20:50 mattias
|
||||
TSplitter can now also work with Align=alNone and AnchorSide
|
||||
|
||||
|
@ -26,6 +26,11 @@ begin
|
||||
// ToDo
|
||||
end;
|
||||
|
||||
procedure TDockTree.SetDockZoneClass(const AValue: TDockZoneClass);
|
||||
begin
|
||||
FDockZoneClass:=AValue;
|
||||
end;
|
||||
|
||||
procedure TDockTree.AdjustDockRect(AControl: TControl; var ARect: TRect);
|
||||
begin
|
||||
|
||||
|
@ -227,6 +227,20 @@ begin
|
||||
inc(FChildCount);
|
||||
end;
|
||||
|
||||
procedure TDockZone.ReplaceChild(OldChild, NewChild: TDockZone);
|
||||
begin
|
||||
NewChild.FParentZone:=Self;
|
||||
NewChild.FNextSibling:=OldChild.FNextSibling;
|
||||
NewChild.FPrevSibling:=OldChild.FPrevSibling;
|
||||
if NewChild.FNextSibling<>nil then
|
||||
NewChild.FNextSibling.FPrevSibling:=NewChild;
|
||||
if NewChild.FPrevSibling<>nil then
|
||||
NewChild.FPrevSibling.FNextSibling:=NewChild;
|
||||
OldChild.FNextSibling:=nil;
|
||||
OldChild.FPrevSibling:=nil;
|
||||
OldChild.FParentZone:=nil;
|
||||
end;
|
||||
|
||||
function TDockZone.GetLastChild: TDockZone;
|
||||
begin
|
||||
Result:=FFirstChildZone;
|
||||
|
@ -45,7 +45,7 @@ type
|
||||
private
|
||||
FAutoFreeDockSite: boolean;
|
||||
protected
|
||||
procedure UndockControlForDocking(TheControl: TControl);
|
||||
procedure UndockControlForDocking(AControl: TControl);
|
||||
public
|
||||
constructor Create(TheDockSite: TWinControl); override;
|
||||
destructor Destroy; override;
|
||||
@ -128,13 +128,13 @@ end;
|
||||
|
||||
function TLazDockPages.GetNoteBookPage(Index: Integer): TLazDockPage;
|
||||
begin
|
||||
Result:=TLazDockPage(GeTLazDockPage(Index));
|
||||
Result:=TLazDockPage(inherited ActivePageComponent);
|
||||
end;
|
||||
|
||||
procedure TLazDockPages.SetActiveNotebookPageComponent(
|
||||
const AValue: TLazDockPage);
|
||||
begin
|
||||
SetActivePageComponent(AValue);
|
||||
ActivePageComponent:=AValue;
|
||||
end;
|
||||
|
||||
constructor TLazDockPages.Create(TheOwner: TComponent);
|
||||
@ -155,9 +155,6 @@ begin
|
||||
if AWinControl.DockManager<>nil then begin
|
||||
// TODO
|
||||
end;
|
||||
if AWinControl.DockSite<>nil then begin
|
||||
// TODO
|
||||
end;
|
||||
end;
|
||||
if AControl.Parent<>nil then begin
|
||||
AControl.Parent:=nil;
|
||||
@ -166,7 +163,7 @@ end;
|
||||
|
||||
constructor TLazDockTree.Create(TheDockSite: TWinControl);
|
||||
begin
|
||||
DockZoneClass:=TLazDockZone;
|
||||
SetDockZoneClass(TLazDockZone);
|
||||
if TheDockSite=nil then begin
|
||||
TheDockSite:=TLazDockForm.Create(nil);
|
||||
TheDockSite.DockManager:=Self;
|
||||
@ -178,10 +175,10 @@ end;
|
||||
destructor TLazDockTree.Destroy;
|
||||
begin
|
||||
if FAutoFreeDockSite then begin
|
||||
if FDockSite.DockManager=Self then
|
||||
FDockSite.DockManager:=nil;
|
||||
FDockSite.Free;
|
||||
FDockSite:=nil;
|
||||
if DockSite.DockManager=Self then
|
||||
DockSite.DockManager:=nil;
|
||||
DockSite.Free;
|
||||
DockSite:=nil;
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -233,7 +230,10 @@ procedure TLazDockTree.InsertControl(AControl: TControl; InsertAt: TAlign;
|
||||
var
|
||||
DropZone: TDockZone;
|
||||
NewZone: TDockZone;
|
||||
NewSplitter: TSplitter;
|
||||
NewOrientation: TDockOrientation;
|
||||
NeedNewParentZone: Boolean;
|
||||
NewParentZone: TDockZone;
|
||||
OldParentZone: TDockZone;
|
||||
begin
|
||||
if DropControl=nil then
|
||||
DropControl:=DockSite;
|
||||
@ -250,6 +250,7 @@ begin
|
||||
// dock
|
||||
// create a new zone for AControl
|
||||
NewZone:=DockZoneClass.Create(Self,AControl);
|
||||
|
||||
// insert new zone into tree
|
||||
if (DropZone=RootZone) and (RootZone.FirstChild=nil) then begin
|
||||
// this is the first child
|
||||
@ -264,32 +265,68 @@ begin
|
||||
DockSite.Visible:=true;
|
||||
end else begin
|
||||
// there are already other childs
|
||||
if DropZone.Parent=nil then begin
|
||||
// insert as child of RootZone
|
||||
// TODO
|
||||
RaiseGDBException('TLazDockTree.InsertControl TODO: DropZone.Parent=nil');
|
||||
end else if DropZone.Parent.ChildCount=1 then begin
|
||||
// insert as second child
|
||||
DropZone.Parent.Orientation:=NewOrientation;
|
||||
if InsertAt in [alLeft,alTop] then
|
||||
DropZone.Parent.AddAsFirstChild(NewZone)
|
||||
else
|
||||
DropZone.Parent.AddAsLastChild(NewZone);
|
||||
// add splitter control
|
||||
NewSplitter:=TSplitter.Create(DockSite);
|
||||
NewSplitter
|
||||
// resize DockSite
|
||||
if InsertAt in [alLeft,alRight] then
|
||||
DockSite.Width:=DockSite.Width+NewSplitter.Width+AControl.Width
|
||||
else if InsertAt in [alTop,alBottom] then
|
||||
DockSite.Width:=DockSite.Height+NewSplitter.Height+AControl.Width
|
||||
|
||||
// add control to DockSite
|
||||
// TODO
|
||||
RaiseGDBException('TLazDockTree.InsertControl TODO: DropZone.Parent<>nil');
|
||||
else
|
||||
RaiseGDBException('TLazDockTree.InsertControl TODO: DropZone.Parent<>nil DropZone.Parent.ChildCount>1');
|
||||
// optimize DropZone
|
||||
if (DropZone.ChildCount>0)
|
||||
and (NewOrientation in [doHorizontal,doVertical])
|
||||
and ((DropZone.Orientation=NewOrientation)
|
||||
or (DropZone.Orientation=doNoOrient))
|
||||
then begin
|
||||
// docking on a side of an inner node is the same as docking to a side of
|
||||
// a child
|
||||
if InsertAt in [alLeft,alTop] then
|
||||
DropZone:=DropZone.FirstChild
|
||||
else
|
||||
DropZone:=DropZone.GetLastChild;
|
||||
end;
|
||||
|
||||
// insert a new Parent Zone if needed
|
||||
NeedNewParentZone:=true;
|
||||
if (DropZone.Parent<>nil) then begin
|
||||
if (DropZone.Orientation=doNoOrient) then
|
||||
NeedNewParentZone:=false;
|
||||
if (DropZone.Orientation=NewOrientation) then
|
||||
NeedNewParentZone:=false;
|
||||
end;
|
||||
if NeedNewParentZone then begin
|
||||
// insert a new zone between current DropZone.Parent and DropZone
|
||||
// this new zone will become the new DropZone.Parent
|
||||
OldParentZone:=DropZone.Parent;
|
||||
NewParentZone:=DockZoneClass.Create(Self,nil);
|
||||
if OldParentZone<>nil then
|
||||
OldParentZone.ReplaceChild(DropZone,NewParentZone);
|
||||
NewParentZone.AddAsFirstChild(DropZone);
|
||||
end;
|
||||
|
||||
// adjust Orientation in tree
|
||||
if DropZone.Parent.Orientation=doNoOrient then
|
||||
DropZone.Parent.Orientation:=NewOrientation;
|
||||
if DropZone.Parent.Orientation<>NewOrientation then
|
||||
RaiseGDBException('TLazDockTree.InsertControl Inconsistency DropZone.Orientation<>NewOrientation');
|
||||
|
||||
// insert new node
|
||||
if DropZone.Parent=nil then
|
||||
RaiseGDBException('TLazDockTree.InsertControl Inconsistency DropZone.Parent=nil');
|
||||
|
||||
if InsertAt in [alLeft,alTop] then
|
||||
DropZone.Parent.AddAsFirstChild(NewZone)
|
||||
else
|
||||
DropZone.Parent.AddAsLastChild(NewZone);
|
||||
|
||||
// add splitter control
|
||||
//NewSplitter:=TSplitter.Create(DockSite);
|
||||
|
||||
// add control to DockSite
|
||||
|
||||
// resize DockSite
|
||||
{if InsertAt in [alLeft,alRight] then
|
||||
DockSite.Width:=DockSite.Width+NewSplitter.Width+AControl.Width
|
||||
else if InsertAt in [alTop,alBottom] then
|
||||
DockSite.Width:=DockSite.Height+NewSplitter.Height+AControl.Width
|
||||
else if InsertAt in [alNone,alClient] then begin
|
||||
// TODO
|
||||
RaiseGDBException('TLazDockTree.InsertControl TODO: InsertAt in [alNone,alClient]');
|
||||
end;}
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -171,7 +171,7 @@ begin
|
||||
end;
|
||||
|
||||
// check if file is already in the package
|
||||
PkgFile:=APackage.FindPkgFile(Filename,false,true);
|
||||
PkgFile:=APackage.FindPkgFile(Filename,false,true,false);
|
||||
if PkgFile<>nil then begin
|
||||
MessageDlg(lisPkgMangFileIsAlreadyInPackage,
|
||||
Format(lisAF2PTheFileIsAlreadyInThePackage, ['"', Filename, '"', #13,
|
||||
@ -434,7 +434,7 @@ begin
|
||||
// skip readonly packages
|
||||
if APackage.ReadOnly then continue;
|
||||
// skip packages, that already contains the file
|
||||
if APackage.FindPkgFile(AFilename,false,true)<>nil then continue;
|
||||
if APackage.FindPkgFile(AFilename,false,true,false)<>nil then continue;
|
||||
if not ShowAllCheckBox.Checked then begin
|
||||
// skip packages, where the filename is not in the package directory
|
||||
// or one of its source directories
|
||||
|
@ -339,7 +339,7 @@ begin
|
||||
|
||||
// check if file already exists in package
|
||||
if FilenameIsAbsolute(AFilename) then begin
|
||||
PkgFile:=LazPackage.FindPkgFile(AFilename,true,true);
|
||||
PkgFile:=LazPackage.FindPkgFile(AFilename,true,true,false);
|
||||
if PkgFile<>nil then begin
|
||||
Msg:=Format(lisA2PFileAlreadyExistsInTheProject, ['"', AFilename, '"']);
|
||||
if PkgFile.Filename<>AFilename then
|
||||
@ -433,7 +433,7 @@ begin
|
||||
Params.UnitFilename:=AddUnitFilenameEdit.Text;
|
||||
Params.UnitName:=AddUnitSrcNameEdit.Text;
|
||||
Params.FileType:=pftUnit;
|
||||
Params.PkgFileFlags:=[];
|
||||
Params.PkgFileFlags:=[pffAddToPkgUsesSection];
|
||||
Params.AutoAddLFMFile:=AddSecondaryFilesCheckBox.Checked;
|
||||
Params.AutoAddLRSFile:=AddSecondaryFilesCheckBox.Checked;
|
||||
if AddUnitHasRegisterCheckBox.Checked then
|
||||
@ -520,36 +520,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.AddFilesPageResize(Sender: TObject);
|
||||
var
|
||||
x: Integer;
|
||||
y: Integer;
|
||||
w: Integer;
|
||||
h: Integer;
|
||||
begin
|
||||
with FilesListView do
|
||||
SetBounds(0,0,Parent.ClientWidth,Parent.ClientHeight-45);
|
||||
|
||||
x:=5;
|
||||
y:=FilesListView.Height+10;
|
||||
w:=100;
|
||||
h:=25;
|
||||
|
||||
with FilesBrowseButton do
|
||||
SetBounds(x,y,w,h);
|
||||
inc(x,w+3);
|
||||
|
||||
with FilesShortenButton do
|
||||
SetBounds(x,y,w,h);
|
||||
inc(x,w+3);
|
||||
|
||||
with FilesDeleteButton do
|
||||
SetBounds(x,y,w,h);
|
||||
inc(x,w+3);
|
||||
|
||||
w:=FilesAddButton.Parent.ClientWidth-x-5;
|
||||
if w<20 then w:=20;
|
||||
with FilesAddButton do
|
||||
SetBounds(x,y,w,h);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.AddFileBrowseButtonClick(Sender: TObject);
|
||||
@ -606,7 +577,7 @@ begin
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
if LazPackage.FindPkgFile(Params.UnitFilename,true,true)<>nil then begin
|
||||
if LazPackage.FindPkgFile(Params.UnitFilename,true,true,false)<>nil then begin
|
||||
MessageDlg(lisA2PFileAlreadyInPackage,
|
||||
Format(lisA2PTheFileIsAlreadyInThePackage, ['"', Params.UnitFilename, '"']
|
||||
),
|
||||
@ -622,6 +593,8 @@ begin
|
||||
end;
|
||||
inc(i);
|
||||
end;
|
||||
if Params.FileType in PkgFileUnitTypes then
|
||||
Include(Params.PkgFileFlags,pffAddToPkgUsesSection);
|
||||
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
@ -712,25 +685,6 @@ begin
|
||||
with AddUnitHasRegisterCheckBox do
|
||||
SetBounds(x,y,Parent.ClientWidth-2*x,Height);
|
||||
inc(y,AddUnitHasRegisterCheckBox.Height+5);
|
||||
|
||||
with AddUnitIsVirtualCheckBox do
|
||||
SetBounds(x,y,Parent.ClientWidth-2*x,Height);
|
||||
inc(y,AddUnitIsVirtualCheckBox.Height+5);
|
||||
|
||||
with AddSecondaryFilesCheckBox do
|
||||
SetBounds(x,y,Parent.ClientWidth-2*x,Height);
|
||||
inc(y,AddSecondaryFilesCheckBox.Height+5);
|
||||
|
||||
with AddUnitUpdateButton do
|
||||
SetBounds(x,y,300,Height);
|
||||
inc(y,AddUnitUpdateButton.Height+25);
|
||||
|
||||
with AddUnitButton do
|
||||
SetBounds(x,y,80,Height);
|
||||
inc(x,AddUnitButton.Width+10);
|
||||
|
||||
with CancelAddUnitButton do
|
||||
SetBounds(x,y,80,Height);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.AddUnitUpdateButtonClick(Sender: TObject);
|
||||
@ -833,12 +787,9 @@ begin
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
if LazPackage.FindPkgFile(Filename,true,true)<>nil then begin
|
||||
MessageDlg(lisA2PFileAlreadyInPackage,
|
||||
Format(lisA2PTheFileIsAlreadyInThePackage, ['"', Filename, '"']
|
||||
),
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
if LazPackage.FindPkgFile(Filename,true,true,false)<>nil then begin
|
||||
// file already in package
|
||||
continue;
|
||||
end;
|
||||
|
||||
if LastParams<>nil then begin
|
||||
@ -854,6 +805,7 @@ begin
|
||||
|
||||
if NewFileType=pftUnit then begin
|
||||
CurParams.AddType:=d2ptUnit;
|
||||
Include(CurParams.PkgFileFlags,pffAddToPkgUsesSection);
|
||||
|
||||
// check filename
|
||||
if not CheckAddingUnitFilename(LazPackage,CurParams.AddType,
|
||||
@ -961,7 +913,7 @@ begin
|
||||
Params.Clear;
|
||||
Params.AddType:=d2ptNewComponent;
|
||||
Params.FileType:=pftUnit;
|
||||
Params.PkgFileFlags:=[pffHasRegisterProc];
|
||||
Params.PkgFileFlags:=[pffHasRegisterProc,pffAddToPkgUsesSection];
|
||||
Params.AncestorType:=AncestorComboBox.Text;
|
||||
Params.NewClassName:=ClassNameEdit.Text;
|
||||
Params.PageName:=PalettePageCombobox.Text;
|
||||
@ -1381,6 +1333,8 @@ begin
|
||||
Parent:=AddUnitPage;
|
||||
Caption:=lisAF2PIsVirtualUnit;
|
||||
OnClick:=@AddUnitIsVirtualCheckBoxClick;
|
||||
AnchorParallel(akLeft,0,AddUnitHasRegisterCheckBox);
|
||||
AnchorToNeighbour(akTop,5,AddUnitHasRegisterCheckBox);
|
||||
end;
|
||||
|
||||
AddSecondaryFilesCheckBox:=TCheckBox.Create(Self);
|
||||
@ -1389,6 +1343,8 @@ begin
|
||||
Parent:=AddUnitPage;
|
||||
Caption:=lisA2PAddLFMLRSFilesIfTheyExist;
|
||||
Checked:=true;
|
||||
AnchorParallel(akLeft,0,AddUnitHasRegisterCheckBox);
|
||||
AnchorToNeighbour(akTop,5,AddUnitIsVirtualCheckBox);
|
||||
end;
|
||||
|
||||
AddUnitUpdateButton:=TButton.Create(Self);
|
||||
@ -1397,6 +1353,9 @@ begin
|
||||
Parent:=AddUnitPage;
|
||||
Caption:=lisA2PUpdateUnitNameAndHasRegisterProcedure;
|
||||
OnClick:=@AddUnitUpdateButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorParallel(akLeft,0,AddUnitHasRegisterCheckBox);
|
||||
AnchorToNeighbour(akTop,5,AddSecondaryFilesCheckBox);
|
||||
end;
|
||||
|
||||
AddUnitButton:=TButton.Create(Self);
|
||||
@ -1405,6 +1364,9 @@ begin
|
||||
Parent:=AddUnitPage;
|
||||
Caption:=lisA2PAddUnit;
|
||||
OnClick:=@AddUnitButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorParallel(akLeft,0,AddUnitHasRegisterCheckBox);
|
||||
AnchorToNeighbour(akTop,25,AddUnitUpdateButton);
|
||||
end;
|
||||
|
||||
CancelAddUnitButton:=TButton.Create(Self);
|
||||
@ -1413,6 +1375,9 @@ begin
|
||||
Parent:=AddUnitPage;
|
||||
Caption:=dlgCancel;
|
||||
OnClick:=@CancelAddUnitButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorToNeighbour(akLeft,10,AddUnitButton);
|
||||
AnchorParallel(akTop,0,AddUnitButton);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1740,6 +1705,7 @@ begin
|
||||
CurColumn.Caption:=lisA2PFilename2;
|
||||
CurColumn:=Columns.Add;
|
||||
CurColumn.Caption:=dlgEnvType;
|
||||
Align:=alTop;
|
||||
end;
|
||||
|
||||
FilesBrowseButton:=TButton.Create(Self);
|
||||
@ -1748,6 +1714,10 @@ begin
|
||||
Parent:=AddFilesPage;
|
||||
Caption:=lisPathEditBrowse;
|
||||
OnClick:=@FilesBrowseButtonClick;
|
||||
Left:=5;
|
||||
AutoSize:=true;
|
||||
Anchors:=Anchors-[akTop]+[akBottom];
|
||||
AnchorParallel(akBottom,5,Parent);
|
||||
end;
|
||||
|
||||
FilesShortenButton:=TButton.Create(Self);
|
||||
@ -1756,6 +1726,9 @@ begin
|
||||
Parent:=AddFilesPage;
|
||||
Caption:=lisA2PSwitchPaths;
|
||||
OnClick:=@FilesShortenButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorToNeighbour(akLeft,5,FilesBrowseButton);
|
||||
AnchorParallel(akTop,0,FilesBrowseButton);
|
||||
end;
|
||||
|
||||
FilesDeleteButton:=TButton.Create(Self);
|
||||
@ -1764,6 +1737,9 @@ begin
|
||||
Parent:=AddFilesPage;
|
||||
Caption:=dlgEdDelete;
|
||||
OnClick:=@FilesDeleteButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorToNeighbour(akLeft,5,FilesShortenButton);
|
||||
AnchorParallel(akTop,0,FilesBrowseButton);
|
||||
end;
|
||||
|
||||
FilesAddButton:=TButton.Create(Self);
|
||||
@ -1772,7 +1748,12 @@ begin
|
||||
Parent:=AddFilesPage;
|
||||
Caption:=lisA2PAddFilesToPackage;
|
||||
OnClick:=@FilesAddButtonClick;
|
||||
AutoSize:=true;
|
||||
AnchorToNeighbour(akLeft,5,FilesDeleteButton);
|
||||
AnchorParallel(akTop,0,FilesBrowseButton);
|
||||
end;
|
||||
|
||||
FilesListView.AnchorToNeighbour(akBottom,5,FilesBrowseButton);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.OnIterateComponentClasses(PkgComponent: TPkgComponent
|
||||
|
@ -86,8 +86,8 @@ type
|
||||
|
||||
// files
|
||||
function GetDefaultSaveDirectoryForFile(const Filename: string): string; virtual; abstract;
|
||||
function OnRenameFile(const OldFilename,
|
||||
NewFilename: string): TModalResult; virtual; abstract;
|
||||
function OnRenameFile(const OldFilename, NewFilename: string;
|
||||
IsPartOfProject: boolean): TModalResult; virtual; abstract;
|
||||
function FindIncludeFileInProjectDependencies(Project1: TProject;
|
||||
const Filename: string): string; virtual; abstract;
|
||||
function SearchFile(const ShortFilename: string;
|
||||
|
@ -135,7 +135,7 @@ const
|
||||
type
|
||||
TPkgFileFlag = (
|
||||
pffHasRegisterProc, // file is unit and has a 'register' procedure
|
||||
pffAddToPkgUsesSection,// unit is added to uses section if package source
|
||||
pffAddToPkgUsesSection,// unit is added to uses section
|
||||
pffReportedAsRemoved // file has been reported as removed
|
||||
);
|
||||
TPkgFileFlags = set of TPkgFileFlag;
|
||||
@ -651,7 +651,8 @@ type
|
||||
procedure ShortenFilename(var ExpandedFilename: string; UseUp: boolean);
|
||||
procedure LongenFilename(var AFilename: string);
|
||||
function FindPkgFile(const AFilename: string;
|
||||
ResolveLinks, IgnoreRemoved: boolean): TPkgFile;
|
||||
ResolveLinks, IgnoreRemoved, FindNewFile: boolean
|
||||
): TPkgFile;
|
||||
function FindUnit(const TheUnitName: string): TPkgFile;
|
||||
function FindUnit(const TheUnitName: string; IgnoreRemoved: boolean): TPkgFile;
|
||||
function FindUnit(const TheUnitName: string; IgnoreRemoved: boolean;
|
||||
@ -2506,15 +2507,28 @@ begin
|
||||
end;
|
||||
|
||||
function TLazPackage.FindPkgFile(const AFilename: string;
|
||||
ResolveLinks, IgnoreRemoved: boolean): TPkgFile;
|
||||
ResolveLinks, IgnoreRemoved, FindNewFile: boolean): TPkgFile;
|
||||
var
|
||||
TheFilename: String;
|
||||
Cnt: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=nil;
|
||||
|
||||
TheFilename:=AFilename;
|
||||
if ResolveLinks then begin
|
||||
|
||||
if FindNewFile and (not FilenameIsAbsolute(TheFilename)) then begin
|
||||
// this is a virtual file, not yet saved
|
||||
// -> prepend Package Directory and check if it does not exists yet in
|
||||
// the package directory
|
||||
LongenFilename(TheFilename);
|
||||
if FileExists(TheFilename) then begin
|
||||
// the file exists -> this virtual file does not belong to the package
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if ResolveLinks and FilenameIsAbsolute(TheFilename) then begin
|
||||
TheFilename:=ReadAllLinks(TheFilename,false);
|
||||
if TheFilename='' then TheFilename:=AFilename;
|
||||
end;
|
||||
|
@ -910,7 +910,7 @@ procedure TPackageEditorForm.AddBitBtnClick(Sender: TObject);
|
||||
if AddParams.AutoAddLFMFile then begin
|
||||
NewLFMFilename:=ChangeFileExt(AddParams.UnitFilename,'.lfm');
|
||||
if FileExists(NewLFMFilename)
|
||||
and (LazPackage.FindPkgFile(NewLFMFilename,false,true)=nil) then
|
||||
and (LazPackage.FindPkgFile(NewLFMFilename,false,true,false)=nil) then
|
||||
LazPackage.AddFile(NewLFMFilename,'',pftLFM,[],cpNormal)
|
||||
else
|
||||
NewLFMFilename:='';
|
||||
@ -919,7 +919,7 @@ procedure TPackageEditorForm.AddBitBtnClick(Sender: TObject);
|
||||
if AddParams.AutoAddLRSFile then begin
|
||||
NewLRSFilename:=ChangeFileExt(AddParams.UnitFilename,'.lrs');
|
||||
if FileExists(NewLRSFilename)
|
||||
and (LazPackage.FindPkgFile(NewLRSFilename,false,true)=nil) then
|
||||
and (LazPackage.FindPkgFile(NewLRSFilename,false,true,false)=nil) then
|
||||
LazPackage.AddFile(NewLRSFilename,'',pftLRS,[],cpNormal)
|
||||
else
|
||||
NewLRSFilename:='';
|
||||
|
@ -156,7 +156,8 @@ type
|
||||
var File1: TPkgFile;
|
||||
var ConflictPkg: TLazPackage): boolean;
|
||||
function FindFileInAllPackages(const TheFilename: string;
|
||||
ResolveLinks, IgnoreDeleted: boolean): TPkgFile;
|
||||
ResolveLinks, IgnoreDeleted,
|
||||
FindNewFile: boolean): TPkgFile;
|
||||
function FindLowestPkgNodeByName(const PkgName: string): TAVLTreeNode;
|
||||
function FindNextSameName(ANode: TAVLTreeNode): TAVLTreeNode;
|
||||
function FindNodeOfDependency(Dependency: TPkgDependency;
|
||||
@ -601,14 +602,15 @@ begin
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.FindFileInAllPackages(const TheFilename: string;
|
||||
ResolveLinks, IgnoreDeleted: boolean): TPkgFile;
|
||||
ResolveLinks, IgnoreDeleted, FindNewFile: boolean): TPkgFile;
|
||||
var
|
||||
Cnt: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
Cnt:=Count;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
Result:=Packages[i].FindPkgFile(TheFilename,ResolveLinks,IgnoreDeleted);
|
||||
Result:=Packages[i].FindPkgFile(TheFilename,ResolveLinks,IgnoreDeleted,
|
||||
FindNewFile);
|
||||
if Result<>nil then exit;
|
||||
end;
|
||||
Result:=nil;
|
||||
|
@ -195,8 +195,8 @@ type
|
||||
// files
|
||||
function GetDefaultSaveDirectoryForFile(const Filename: string): string; override;
|
||||
function GetPublishPackageDir(APackage: TLazPackage): string;
|
||||
function OnRenameFile(const OldFilename,
|
||||
NewFilename: string): TModalResult; override;
|
||||
function OnRenameFile(const OldFilename, NewFilename: string;
|
||||
IsPartOfProject: boolean): TModalResult; override;
|
||||
function FindIncludeFileInProjectDependencies(Project1: TProject;
|
||||
const Filename: string): string; override;
|
||||
function AddUnitDependenciesForComponentClasses(const UnitFilename: string;
|
||||
@ -654,7 +654,8 @@ begin
|
||||
|
||||
Filename:=ActiveUnitInfo.Filename;
|
||||
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true);
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true,
|
||||
not ActiveUnitInfo.IsPartOfProject);
|
||||
if PkgFile=nil then begin
|
||||
MessageDlg(lisProjAddPackageNotFound,
|
||||
lisPkgThisFileIsNotInAnyLoadedPackage, mtInformation,
|
||||
@ -1062,7 +1063,7 @@ begin
|
||||
end;
|
||||
|
||||
// check file name conflicts with files in other packages
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(NewFilename,true,true);
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(NewFilename,true,true,false);
|
||||
if PkgFile<>nil then begin
|
||||
Result:=MessageDlg(lisPkgMangFilenameIsUsedByOtherPackage,
|
||||
Format(lisPkgMangTheFileNameIsUsedByThePackageInFile, ['"',
|
||||
@ -2019,7 +2020,7 @@ var
|
||||
PkgFile: TPkgFile;
|
||||
begin
|
||||
Result:='';
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true);
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true,true);
|
||||
if PkgFile=nil then exit;
|
||||
APackage:=PkgFile.LazPackage;
|
||||
if APackage.AutoCreated or (not APackage.HasDirectory) then exit;
|
||||
@ -2870,21 +2871,24 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TPkgManager.OnRenameFile(const OldFilename, NewFilename: string
|
||||
): TModalResult;
|
||||
function TPkgManager.OnRenameFile(const OldFilename, NewFilename: string;
|
||||
IsPartOfProject: boolean): TModalResult;
|
||||
var
|
||||
OldPackage: TLazPackage;
|
||||
OldPkgFile: TPkgFile;
|
||||
NewPkgFile: TPkgFile;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
if (OldFilename=NewFilename) or (not FilenameIsPascalUnit(NewFilename)) then
|
||||
if (OldFilename=NewFilename) then
|
||||
exit;
|
||||
OldPkgFile:=PackageGraph.FindFileInAllPackages(OldFilename,false,true);
|
||||
debugln('TPkgManager.OnRenameFile A OldFilename="',OldFilename,'" New="',NewFilename,'"');
|
||||
OldPkgFile:=PackageGraph.FindFileInAllPackages(OldFilename,false,true,
|
||||
not IsPartOfProject);
|
||||
if (OldPkgFile=nil) or (OldPkgFile.LazPackage.ReadOnly) then
|
||||
exit;
|
||||
OldPackage:=OldPkgFile.LazPackage;
|
||||
NewPkgFile:=PackageGraph.FindFileInAllPackages(NewFilename,false,true);
|
||||
debugln('TPkgManager.OnRenameFile A OldPackage="',OldPackage.Name);
|
||||
NewPkgFile:=PackageGraph.FindFileInAllPackages(NewFilename,false,true,false);
|
||||
if (NewPkgFile<>nil) and (OldPackage<>NewPkgFile.LazPackage) then exit;
|
||||
|
||||
Result:=MessageDlg(lisPkgMangRenameFileInPackage,
|
||||
@ -3203,7 +3207,7 @@ begin
|
||||
Result.Add(Project1);
|
||||
end;
|
||||
// find all packages owning file
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(UnitFilename,false,true);
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(UnitFilename,false,true,true);
|
||||
if (PkgFile<>nil) and (PkgFile.LazPackage<>nil) then
|
||||
Result.Add(PkgFile.LazPackage);
|
||||
if Result.Count=0 then
|
||||
@ -3371,7 +3375,7 @@ begin
|
||||
end;
|
||||
|
||||
// check if file is already in a package
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true);
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,false,true,true);
|
||||
if PkgFile<>nil then begin
|
||||
Result:=MessageDlg(lisPkgMangFileIsAlreadyInPackage,
|
||||
Format(lisPkgMangTheFileIsAlreadyInThePackage, ['"', Filename, '"', #13,
|
||||
|
Loading…
Reference in New Issue
Block a user