mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 00:59:31 +02:00
splittet designer form and lookup root
git-svn-id: trunk@4220 -
This commit is contained in:
parent
c19dfdc3b2
commit
ed5f8759dc
@ -35,13 +35,9 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{
|
||||
Should I include typinfo.pp and use TTypeKind instead of TPropertyType
|
||||
or use TPropertyType
|
||||
}
|
||||
|
||||
// TPropertyType = (ptUnknown, ptInteger, ptChar, ptEnumeration,ptFloat,ptString,ptSet,
|
||||
// ptClass, ptMethod,ptWChar, ptLString, LWString, ptVariant);
|
||||
{ Should I include typinfo.pp and use TTypeKind instead of TPropertyType
|
||||
or use TPropertyType
|
||||
}
|
||||
|
||||
TIComponentInterface = class
|
||||
public
|
||||
@ -51,10 +47,10 @@ or use TPropertyType
|
||||
Function IsTControl : Boolean; virtual; abstract;
|
||||
Function GetPropCount : Integer; virtual; abstract;
|
||||
Function GetPropType(Index : Integer) : TTypeKind; virtual; abstract;
|
||||
// Function GetPropType(Index : Integer) : TPropertyType; virtual; abstract;
|
||||
// Function GetPropType(Index : Integer) : TPropertyType; virtual; abstract;
|
||||
Function GetPropName(Index : Integer) : String; virtual; abstract;
|
||||
Function GetPropTypebyName(Name : String) : TTypeKind; virtual; abstract;
|
||||
// Function GetPropTypebyName(Name : String) : TPropertyType; virtual; abstract;
|
||||
// Function GetPropTypebyName(Name : String) : TPropertyType; virtual; abstract;
|
||||
Function GetPropTypeName(Index : Integer) : String; virtual; abstract;
|
||||
|
||||
|
||||
@ -75,47 +71,40 @@ or use TPropertyType
|
||||
end;
|
||||
|
||||
|
||||
{ TIFormInterface - currently not used }
|
||||
|
||||
TIFormInterface = class
|
||||
public
|
||||
Function Filename : AnsiString; virtual; abstract;
|
||||
Function FormModified : Boolean; virtual; abstract;
|
||||
Function MArkModified : Boolean; virtual; abstract;
|
||||
Function MarkModified : Boolean; virtual; abstract;
|
||||
Function GetFormComponent : TIComponentInterface; virtual; abstract;
|
||||
Function FindComponent : TIComponentInterface; virtual; abstract;
|
||||
Function GetComponentfromHandle(ComponentHandle:Pointer): TIComponentInterface; virtual; abstract;
|
||||
|
||||
Function GetSelCount: Integer; virtual; abstract;
|
||||
Function GetSelComponent(Index : Integer): TIComponentInterface; virtual; abstract;
|
||||
Function CreateComponent(CI : TIComponentInterface; TypeClass : TComponentClass;
|
||||
X,Y,W,H : Integer): TIComponentInterface; virtual; abstract;
|
||||
Function CreateComponent(CI : TIComponentInterface; TypeClass : TComponentClass;
|
||||
X,Y,W,H : Integer): TIComponentInterface; virtual; abstract;
|
||||
end;
|
||||
|
||||
{
|
||||
Created by Shane Miller
|
||||
This unit defines the layout for the forms editor. The forms editor is responsible
|
||||
for creating a form, holding a list of selected controls, determining if the form was
|
||||
modified and working wit the object inspector.
|
||||
This unit defines the layout for the forms editor. The forms editor is
|
||||
responsible for creating all forms, holding all component interfaces .
|
||||
}
|
||||
|
||||
TAbstractFormEditor = class
|
||||
public
|
||||
Function FormModified : Boolean; virtual; abstract;
|
||||
Function FindComponentByName(const Name : ShortString) : TIComponentInterface; virtual; abstract;
|
||||
Function FindComponent(AComponent: TComponent): TIComponentInterface; virtual; abstract;
|
||||
public
|
||||
Function FindComponentByName(const Name : ShortString) : TIComponentInterface; virtual; abstract;
|
||||
Function FindComponent(AComponent: TComponent): TIComponentInterface; virtual; abstract;
|
||||
|
||||
Function GetFormComponent: TIComponentInterface; virtual; abstract;
|
||||
Function GetComponentByHandle(const Value : Longint): TIComponentInterface; virtual; abstract;
|
||||
|
||||
Function GetSelCount : Integer; virtual; abstract;
|
||||
Function GetSelComponent(Index : Integer) : TIComponentInterface; virtual; abstract;
|
||||
|
||||
// Function CreateComponent(CI : TIComponentInterface; TypeName : ShortString;
|
||||
Function CreateComponent(CI : TIComponentInterface; TypeClass : TComponentClass;
|
||||
Function CreateComponent(CI : TIComponentInterface; TypeClass : TComponentClass;
|
||||
X,Y,W,H : Integer): TIComponentInterface; virtual; abstract;
|
||||
Function CreateComponentFromStream(BinStream: TStream;
|
||||
Function CreateComponentFromStream(BinStream: TStream;
|
||||
AncestorType: TComponentClass
|
||||
): TIComponentInterface; virtual; abstract;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
@ -106,8 +106,10 @@ type
|
||||
FCachedWidth: integer;
|
||||
FCachedHeight: integer;
|
||||
FCachedFormRelativeLeftTop: TPoint;
|
||||
FComponent:TComponent;
|
||||
FComponent: TComponent;
|
||||
FDesignerForm: TCustomForm;
|
||||
FFlags: TSelectedControlFlags;
|
||||
FIsTControl: boolean;
|
||||
FOldLeft: integer;
|
||||
FOldTop: integer;
|
||||
FOldWidth: integer;
|
||||
@ -129,7 +131,6 @@ type
|
||||
public
|
||||
constructor Create(AnOwner: TControlSelection; AComponent: TComponent);
|
||||
destructor Destroy; override;
|
||||
function ParentForm: TCustomForm;
|
||||
procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||
procedure SetFormRelativeBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||
procedure SaveBounds;
|
||||
@ -139,7 +140,7 @@ type
|
||||
function ParentInSelection: boolean;
|
||||
procedure InvalidateNonVisualComponent;
|
||||
|
||||
property Component: TComponent read FComponent write FComponent;
|
||||
property Component: TComponent read FComponent;
|
||||
property Owner: TControlSelection read FOwner write SetOwner;
|
||||
property Left: integer read GetLeft write SetLeft;
|
||||
property Top: integer read GetTop write SetTop;
|
||||
@ -153,13 +154,27 @@ type
|
||||
read FOldFormRelativeLeftTop write FOldFormRelativeLeftTop;
|
||||
property Flags: TSelectedControlFlags read FFlags write SetFlags;
|
||||
property UseCache: boolean read FUseCache write SetUseCache;
|
||||
property IsTControl: boolean read FIsTControl;
|
||||
property DesignerForm: TCustomForm read FDesignerForm;
|
||||
end;
|
||||
|
||||
|
||||
TComponentAlignment = (csaNone, csaSides1, csaCenters, csaSides2,
|
||||
csaCenterInWindow, csaSpaceEqually, csaSide1SpaceEqually,
|
||||
csaSide2SpaceEqually);
|
||||
TComponentSizing = (cssNone, cssShrinkToSmallest, cssGrowToLargest, cssFixed);
|
||||
TComponentAlignment = (
|
||||
csaNone,
|
||||
csaSides1,
|
||||
csaCenters,
|
||||
csaSides2,
|
||||
csaCenterInWindow,
|
||||
csaSpaceEqually,
|
||||
csaSide1SpaceEqually,
|
||||
csaSide2SpaceEqually
|
||||
);
|
||||
TComponentSizing = (
|
||||
cssNone,
|
||||
cssShrinkToSmallest,
|
||||
cssGrowToLargest,
|
||||
cssFixed
|
||||
);
|
||||
TSelectionSortCompare = function(Index1, Index2: integer): integer of object;
|
||||
TOnSelectionFormChanged = procedure(Sender: TObject;
|
||||
OldForm, NewForm: TCustomForm) of object;
|
||||
@ -189,10 +204,13 @@ type
|
||||
{ TControlSelection }
|
||||
|
||||
TControlSelState = (
|
||||
cssLookupRootSelected,
|
||||
cssOnlyNonVisualNeedsUpdate,
|
||||
cssOnlyNonVisualSelected,
|
||||
cssOnlyVisualNeedsUpdate,
|
||||
cssOnlyVisualNeedsSelected,
|
||||
cssOnlyInvisibleNeedsUpdate,
|
||||
cssOnlyInvisibleSelected,
|
||||
cssBoundsNeedsUpdate,
|
||||
cssBoundsNeedsSaving,
|
||||
cssParentLevelNeedsUpdate,
|
||||
@ -210,82 +228,81 @@ type
|
||||
TControlSelStates = set of TControlSelState;
|
||||
|
||||
TControlSelection = class(TObject)
|
||||
procedure GrabberMove(Grabber: TGrabber; const OldRect, NewRect: TRect);
|
||||
private
|
||||
FControls: TList; // list of TSelectedComponent
|
||||
|
||||
// current bounds of the selection (only valid if Count>0)
|
||||
// These are the values set by the user
|
||||
// But due to snapping and lcl aligning the components can have other bounds
|
||||
FLeft: Integer;
|
||||
FOnSelectionFormChanged: TOnSelectionFormChanged;
|
||||
FRubberbandCreationColor: TColor;
|
||||
FRubberbandSelectionColor: TColor;
|
||||
FSavedHeight: integer;
|
||||
FSavedLeft: integer;
|
||||
FSavedTop: integer;
|
||||
FSavedWidth: integer;
|
||||
FTop: Integer;
|
||||
FWidth: Integer;
|
||||
FHeight: Integer;
|
||||
|
||||
// These are the real bounds of the selection (only valid if Count>0)
|
||||
FRealLeft: integer;
|
||||
FRealTop: integer;
|
||||
FRealWidth: integer;
|
||||
FRealHeight: integer;
|
||||
|
||||
// saved bounds of the selection (only valid if Count>0)
|
||||
FOldLeft: integer;
|
||||
FOldTop: integer;
|
||||
FOldWidth: integer;
|
||||
FOldHeight: integer;
|
||||
|
||||
// caches
|
||||
FGuideLinesCache: array[TGuideLineType] of TGuideLineCache;
|
||||
FParentLevel: integer;
|
||||
|
||||
FCustomForm: TCustomForm;
|
||||
FActiveGrabber: TGrabber;
|
||||
FForm: TCustomForm;// form to draw on (not necessarily the root)
|
||||
FGrabbers: array[TGrabIndex] of TGrabber;
|
||||
FGrabberSize: integer;
|
||||
FMarkerSize: integer;
|
||||
FActiveGrabber: TGrabber;
|
||||
FRubberBandBounds: TRect;
|
||||
FRubberbandType: TRubberbandType;
|
||||
FUpdateLock: integer;
|
||||
FResizeLockCount: integer;
|
||||
FStates: TControlSelStates;
|
||||
|
||||
FOnChange: TNotifyEvent;
|
||||
FOnPropertiesChanged: TNotifyEvent;
|
||||
FOnSelectionFormChanged: TOnSelectionFormChanged;
|
||||
FResizeLockCount: integer;
|
||||
FRubberBandBounds: TRect;
|
||||
FRubberbandCreationColor: TColor;
|
||||
FRubberbandSelectionColor: TColor;
|
||||
FRubberbandType: TRubberbandType;
|
||||
FLookupRoot: TComponent;// component owning the selected components
|
||||
FStates: TControlSelStates;
|
||||
FUpdateLock: integer;
|
||||
|
||||
function CompareBottom(Index1, Index2: integer): integer;
|
||||
function CompareHorCenter(Index1, Index2: integer): integer;
|
||||
function CompareInts(i1, i2: integer): integer;
|
||||
function CompareLeft(Index1, Index2: integer): integer;
|
||||
function CompareRight(Index1, Index2: integer): integer;
|
||||
function CompareTop(Index1, Index2: integer): integer;
|
||||
function CompareVertCenter(Index1, Index2: integer): integer;
|
||||
function GetCacheGuideLines: boolean;
|
||||
function GetGrabberColor: TColor;
|
||||
function GetGrabbers(AGrabIndex:TGrabIndex): TGrabber;
|
||||
function GetItems(Index:integer):TSelectedControl;
|
||||
function GetMarkerColor: TColor;
|
||||
function GetRubberbandActive: boolean;
|
||||
function GetRubberbandCreationColor: TColor;
|
||||
function GetRubberbandSelectionColor: TColor;
|
||||
function GetSelectionOwner: TComponent;
|
||||
function GetSnapping: boolean;
|
||||
function GetVisible: boolean;
|
||||
procedure SetCacheGuideLines(const AValue: boolean);
|
||||
procedure SetCustomForm;
|
||||
function GetGrabbers(AGrabIndex:TGrabIndex): TGrabber;
|
||||
procedure SetGrabbers(AGrabIndex:TGrabIndex; const AGrabber: TGrabber);
|
||||
procedure SetGrabberSize(const NewSize: integer);
|
||||
procedure DoChange;
|
||||
procedure DoChangeProperties;
|
||||
procedure GrabberMove(Grabber: TGrabber; const OldRect, NewRect: TRect);
|
||||
procedure SetActiveGrabber(AGrabber:TGrabber);
|
||||
procedure SetCacheGuideLines(const AValue: boolean);
|
||||
procedure SetCustomForm;
|
||||
procedure SetGrabbers(AGrabIndex:TGrabIndex; const AGrabber: TGrabber);
|
||||
procedure SetGrabberSize(const NewSize: integer);
|
||||
procedure SetItems(Index:integer; ASelectedControl:TSelectedControl);
|
||||
procedure SetRubberbandActive(const AValue: boolean);
|
||||
procedure SetRubberBandBounds(ARect:TRect);
|
||||
procedure SetRubberbandType(const AValue: TRubberbandType);
|
||||
procedure SetSnapping(const AValue: boolean);
|
||||
procedure SetVisible(const AValue: Boolean);
|
||||
function GetItems(Index:integer):TSelectedControl;
|
||||
procedure SetItems(Index:integer; ASelectedControl:TSelectedControl);
|
||||
procedure SetActiveGrabber(AGrabber:TGrabber);
|
||||
procedure SetRubberBandBounds(ARect:TRect);
|
||||
function CompareInts(i1, i2: integer): integer;
|
||||
function CompareLeft(Index1, Index2: integer): integer;
|
||||
function CompareTop(Index1, Index2: integer): integer;
|
||||
function CompareRight(Index1, Index2: integer): integer;
|
||||
function CompareBottom(Index1, Index2: integer): integer;
|
||||
function CompareHorCenter(Index1, Index2: integer): integer;
|
||||
function CompareVertCenter(Index1, Index2: integer): integer;
|
||||
protected
|
||||
procedure AdjustGrabbers;
|
||||
procedure InvalidateGrabbers;
|
||||
@ -298,30 +315,33 @@ type
|
||||
function CleanGridSizeX: integer;
|
||||
function CleanGridSizeY: integer;
|
||||
function ComponentAlignable(AComponent: TComponent): boolean;
|
||||
procedure ImproveNearestInt(var NearestInt: TNearestInt; Candidate: integer);
|
||||
procedure FindNearestGridX(var NearestInt: TNearestInt);
|
||||
procedure FindNearestGridY(var NearestInt: TNearestInt);
|
||||
procedure FindNearestLeftGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestRightGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestTopGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestBottomGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestClientLeftRight(var NearestInt: TNearestInt);
|
||||
procedure FindNearestClientTopBottom(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldLeft(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldRight(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldTop(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldBottom(var NearestInt: TNearestInt);
|
||||
function GetBottomGuideLine(var ALine: TRect): boolean;
|
||||
function GetLeftGuideLine(var ALine: TRect): boolean;
|
||||
function GetRightGuideLine(var ALine: TRect): boolean;
|
||||
function GetTopGuideLine(var ALine: TRect): boolean;
|
||||
function GetBottomGuideLine(var ALine: TRect): boolean;
|
||||
procedure FindNearestBottomGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestClientLeftRight(var NearestInt: TNearestInt);
|
||||
procedure FindNearestClientTopBottom(var NearestInt: TNearestInt);
|
||||
procedure FindNearestGridX(var NearestInt: TNearestInt);
|
||||
procedure FindNearestGridY(var NearestInt: TNearestInt);
|
||||
procedure FindNearestLeftGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldBottom(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldLeft(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldRight(var NearestInt: TNearestInt);
|
||||
procedure FindNearestOldTop(var NearestInt: TNearestInt);
|
||||
procedure FindNearestRightGuideLine(var NearestInt: TNearestInt);
|
||||
procedure FindNearestTopGuideLine(var NearestInt: TNearestInt);
|
||||
procedure ImproveNearestInt(var NearestInt: TNearestInt; Candidate: integer);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
|
||||
// items
|
||||
property Items[Index:integer]:TSelectedControl
|
||||
read GetItems write SetItems; default;
|
||||
function Count:integer;
|
||||
|
||||
procedure Sort(SortProc: TSelectionSortCompare);
|
||||
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
property UpdateLock: integer read FUpdateLock;
|
||||
@ -336,23 +356,30 @@ type
|
||||
function IsSelected(AComponent: TComponent): Boolean;
|
||||
function IsOnlySelected(AComponent: TComponent): Boolean;
|
||||
procedure SaveBounds;
|
||||
|
||||
function ParentLevel: integer;
|
||||
function OnlyNonVisualComponentsSelected: boolean;
|
||||
function OnlyVisualComponentsSelected: boolean;
|
||||
function OnlyInvisibleComponentsSelected: boolean;
|
||||
function LookupRootSelected: boolean;
|
||||
|
||||
// resizing, moving, aligning, mirroring, ...
|
||||
function IsResizing: boolean;
|
||||
procedure BeginResizing;
|
||||
procedure EndResizing(ApplyUserBounds: boolean);
|
||||
procedure UpdateBounds;
|
||||
|
||||
procedure MoveSelection(dx, dy: integer);
|
||||
function MoveSelectionWithSnapping(TotalDX, TotalDY: integer): boolean;
|
||||
procedure SizeSelection(dx, dy: integer);
|
||||
procedure SetBounds(NewLeft,NewTop,NewWidth,NewHeight: integer);
|
||||
// size all controls depending on ActiveGrabber.
|
||||
// if ActiveGrabber=nil then Right,Bottom
|
||||
procedure AlignComponents(HorizAlignment,VertAlignment:TComponentAlignment);
|
||||
procedure MirrorHorizontal;
|
||||
procedure MirrorVertical;
|
||||
procedure SizeComponents(HorizSizing: TComponentSizing; AWidth: integer;
|
||||
VertSizing: TComponentSizing; AHeight: integer);
|
||||
VertSizing: TComponentSizing; AHeight: integer);
|
||||
procedure ScaleComponents(Percent: integer);
|
||||
|
||||
// snapping
|
||||
function FindNearestSnapLeft(ALeft, AWidth: integer): integer;
|
||||
function FindNearestSnapLeft(ALeft: integer): integer;
|
||||
function FindNearestSnapRight(ARight: integer): integer;
|
||||
@ -365,8 +392,8 @@ type
|
||||
property CacheGuideLines: boolean
|
||||
read GetCacheGuideLines write SetCacheGuideLines;
|
||||
procedure InvalidateGuideLinesCache;
|
||||
function ParentLevel: integer;
|
||||
|
||||
// grabbers and markers
|
||||
property GrabberSize:integer read FGrabberSize write SetGrabberSize;
|
||||
property GrabberColor: TColor read GetGrabberColor;
|
||||
procedure DrawGrabbers(DC: TDesignerDeviceContext);
|
||||
@ -383,42 +410,42 @@ type
|
||||
ALeft, ATop, AWidth, AHeight: integer);
|
||||
property ActiveGrabber: TGrabber read FActiveGrabber write SetActiveGrabber;
|
||||
|
||||
// user wished bounds:
|
||||
property Left:integer read FLeft;
|
||||
property Top:integer read FTop;
|
||||
property Width:integer read FWidth;
|
||||
property Height:integer read FHeight;
|
||||
|
||||
// real current bounds
|
||||
property RealLeft:integer read FRealLeft;
|
||||
property RealTop:integer read FRealTop;
|
||||
property RealWidth:integer read FRealWidth;
|
||||
property RealHeight:integer read FRealHeight;
|
||||
|
||||
property SavedLeft:integer read FSavedLeft;
|
||||
property SavedTop:integer read FSavedTop;
|
||||
property SavedWidth:integer read FSavedWidth;
|
||||
property SavedHeight:integer read FSavedHeight;
|
||||
// bounds before resizing
|
||||
property OldLeft:integer read FOldLeft;
|
||||
property OldTop:integer read FOldTop;
|
||||
property OldWidth:integer read FOldWidth;
|
||||
property OldHeight:integer read FOldHeight;
|
||||
|
||||
property RubberbandBounds:TRect
|
||||
read FRubberbandBounds write SetRubberbandBounds;
|
||||
property RubberbandActive: boolean
|
||||
read GetRubberbandActive write SetRubberbandActive;
|
||||
property RubberbandType: TRubberbandType
|
||||
read FRubberbandType write SetRubberbandType;
|
||||
property RubberbandSelectionColor: TColor
|
||||
read GetRubberbandSelectionColor;
|
||||
property RubberbandCreationColor: TColor
|
||||
read GetRubberbandCreationColor;
|
||||
// rubberband
|
||||
property RubberbandBounds:TRect read FRubberbandBounds
|
||||
write SetRubberbandBounds;
|
||||
property RubberbandActive: boolean read GetRubberbandActive
|
||||
write SetRubberbandActive;
|
||||
property RubberbandType: TRubberbandType read FRubberbandType
|
||||
write SetRubberbandType;
|
||||
property RubberbandSelectionColor: TColor read GetRubberbandSelectionColor;
|
||||
property RubberbandCreationColor: TColor read GetRubberbandCreationColor;
|
||||
procedure DrawRubberband(DC: TDesignerDeviceContext);
|
||||
procedure SelectWithRubberBand(ACustomForm:TCustomForm;
|
||||
ClearBefore, ExclusiveOr: boolean; var SelectionChanged: boolean;
|
||||
MaxParentControl: TControl);
|
||||
procedure SelectWithRubberBand(ALookupRoot: TComponent;
|
||||
ClearBefore, ExclusiveOr: boolean;
|
||||
var SelectionChanged: boolean;
|
||||
MaxParentControl: TControl);
|
||||
|
||||
procedure Sort(SortProc: TSelectionSortCompare);
|
||||
property Visible:boolean read GetVisible write SetVisible;
|
||||
function OnlyNonVisualComponentsSelected: boolean;
|
||||
function OnlyVisualComponentsSelected: boolean;
|
||||
|
||||
property SelectionForm: TCustomForm read FCustomForm;
|
||||
|
||||
property SelectionForm: TCustomForm read FForm;
|
||||
property OnSelectionFormChanged: TOnSelectionFormChanged
|
||||
read FOnSelectionFormChanged write FOnSelectionFormChanged;
|
||||
end;
|
||||
@ -494,6 +521,8 @@ begin
|
||||
inherited Create;
|
||||
FOwner:=AnOwner;
|
||||
FComponent:=AComponent;
|
||||
FIsTControl:=FComponent is TControl;
|
||||
FDesignerForm:=GetDesignerForm(FComponent);
|
||||
end;
|
||||
|
||||
destructor TSelectedControl.Destroy;
|
||||
@ -501,20 +530,9 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TSelectedControl.ParentForm: TCustomForm;
|
||||
begin
|
||||
if FComponent is TControl then
|
||||
Result:=GetParentForm(TControl(FComponent))
|
||||
else
|
||||
if FComponent.Owner is TCustomForm then
|
||||
Result:=TCustomForm(FComponent.Owner)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
procedure TSelectedControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||
begin
|
||||
if FComponent is TControl then begin
|
||||
if FIsTControl then begin
|
||||
TControl(FComponent).SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
FCachedLeft:=ALeft;
|
||||
FCachedTop:=ATop;
|
||||
@ -558,7 +576,8 @@ end;
|
||||
|
||||
function TSelectedControl.IsTopLvl: boolean;
|
||||
begin
|
||||
Result:=(FComponent is TControl) and (TControl(FComponent).Parent=nil);
|
||||
Result:=(FComponent.Owner=nil)
|
||||
or (FIsTControl and (TControl(FComponent).Parent=nil));
|
||||
end;
|
||||
|
||||
function TSelectedControl.ChildInSelection: boolean;
|
||||
@ -586,8 +605,8 @@ var
|
||||
AForm: TCustomForm;
|
||||
CompRect: TRect;
|
||||
begin
|
||||
AForm:=TCustomForm(FComponent.Owner);
|
||||
if (AForm=nil) or (not (AForm is TCustomForm)) then exit;
|
||||
AForm:=DesignerForm;
|
||||
if (AForm=nil) then exit;
|
||||
CompRect.Left:=LongRec(FComponent.DesignInfo).Lo;
|
||||
CompRect.Top:=LongRec(FComponent.DesignInfo).Hi;
|
||||
CompRect.Right:=CompRect.Left+NonVisualCompWidth;
|
||||
@ -611,7 +630,7 @@ end;
|
||||
|
||||
procedure TSelectedControl.SetLeft(ALeft: integer);
|
||||
begin
|
||||
if FComponent is TControl then
|
||||
if FIsTControl then
|
||||
TControl(FComponent).Left:=Aleft
|
||||
else
|
||||
LongRec(FComponent.DesignInfo).Lo:=Min(32000,Max(0,ALeft));
|
||||
@ -634,7 +653,7 @@ end;
|
||||
|
||||
procedure TSelectedControl.SetTop(ATop: integer);
|
||||
begin
|
||||
if FComponent is TControl then
|
||||
if FIsTControl then
|
||||
TControl(FComponent).Top:=ATop
|
||||
else
|
||||
LongRec(FComponent.DesignInfo).Hi:=Min(32000,Max(0,ATop));
|
||||
@ -658,7 +677,7 @@ end;
|
||||
|
||||
procedure TSelectedControl.SetWidth(AWidth: integer);
|
||||
begin
|
||||
if FComponent is TControl then
|
||||
if FIsTControl then
|
||||
TControl(FComponent).Width:=AWidth
|
||||
else
|
||||
;
|
||||
@ -667,12 +686,15 @@ end;
|
||||
|
||||
function TSelectedControl.GetHeight: integer;
|
||||
begin
|
||||
Result:=GetComponentHeight(FComponent);
|
||||
if FUseCache then
|
||||
Result:=FCachedHeight
|
||||
else
|
||||
Result:=GetComponentHeight(FComponent);
|
||||
end;
|
||||
|
||||
procedure TSelectedControl.SetHeight(AHeight: integer);
|
||||
begin
|
||||
if FComponent is TControl then
|
||||
if FIsTControl then
|
||||
TControl(FComponent).Height:=AHeight
|
||||
else
|
||||
;
|
||||
@ -696,10 +718,12 @@ begin
|
||||
FGrabbers[g].Cursor:=GRAB_CURSOR[g];
|
||||
FGrabbers[g].OnMove:=@GrabberMove;
|
||||
end;
|
||||
FCustomForm:=nil;
|
||||
FForm:=nil;
|
||||
FLookupRoot:=nil;
|
||||
FActiveGrabber:=nil;
|
||||
FUpdateLock:=0;
|
||||
FStates:=[cssOnlyNonVisualNeedsUpdate,cssOnlyVisualNeedsUpdate,
|
||||
cssOnlyInvisibleNeedsUpdate,
|
||||
cssParentLevelNeedsUpdate,cssCacheGuideLines];
|
||||
FRubberbandType:=rbtSelection;
|
||||
FRubberbandCreationColor:=clMaroon;
|
||||
@ -791,9 +815,9 @@ end;
|
||||
procedure TControlSelection.GrabberMove(Grabber: TGrabber; const OldRect,
|
||||
NewRect: TRect);
|
||||
begin
|
||||
if FCustomForm=nil then exit;
|
||||
InvalidateRect(FCustomForm.Handle,@OldRect,false);
|
||||
InvalidateRect(FCustomForm.Handle,@NewRect,false);
|
||||
if FForm=nil then exit;
|
||||
InvalidateRect(FForm.Handle,@OldRect,false);
|
||||
InvalidateRect(FForm.Handle,@NewRect,false);
|
||||
end;
|
||||
|
||||
function TControlSelection.GetCacheGuideLines: boolean;
|
||||
@ -816,15 +840,16 @@ var
|
||||
OldCustomForm, NewCustomForm: TCustomForm;
|
||||
begin
|
||||
if Count>0 then
|
||||
NewCustomForm:=Items[0].ParentForm
|
||||
NewCustomForm:=Items[0].DesignerForm
|
||||
else
|
||||
NewCustomForm:=nil;
|
||||
if NewCustomForm=FCustomForm then exit;
|
||||
if NewCustomForm=FForm then exit;
|
||||
// form changed
|
||||
InvalidateGuideLines;
|
||||
InvalidateGrabbers;
|
||||
OldCustomForm:=FCustomForm;
|
||||
FCustomForm:=NewCustomForm;
|
||||
OldCustomForm:=FForm;
|
||||
FForm:=NewCustomForm;
|
||||
FLookupRoot:=GetSelectionOwner;
|
||||
if Assigned(FOnSelectionFormChanged) then
|
||||
FOnSelectionFormChanged(Self,OldCustomForm,NewCustomForm);
|
||||
end;
|
||||
@ -891,7 +916,7 @@ var g: TGrabIndex;
|
||||
begin
|
||||
if cssGrabbersPainted in FStates then begin
|
||||
for g:=Low(TGrabIndex) to High(TGrabIndex) do
|
||||
FGrabbers[g].InvalidateOnForm(FCustomForm);
|
||||
FGrabbers[g].InvalidateOnForm(FForm);
|
||||
Exclude(FStates,cssGrabbersPainted);
|
||||
end;
|
||||
end;
|
||||
@ -902,14 +927,14 @@ var
|
||||
LineRect: TRect;
|
||||
begin
|
||||
if (cssGuideLinesPainted in FStates) then begin
|
||||
if (FCustomForm<>nil) and CacheGuideLines then
|
||||
if (FForm<>nil) and CacheGuideLines then
|
||||
for g:=Low(g) to High(g) do begin
|
||||
if FGuideLinesCache[g].PaintedLineValid then
|
||||
begin
|
||||
LineRect:=FGuideLinesCache[g].PaintedLine;
|
||||
if LineRect.Top=LineRect.Bottom then inc(LineRect.Bottom);
|
||||
if LineRect.Left=LineRect.Right then inc(LineRect.Right);
|
||||
InvalidateRect(FCustomForm.Handle,@LineRect,false);
|
||||
InvalidateRect(FForm.Handle,@LineRect,false);
|
||||
end;
|
||||
end;
|
||||
Exclude(FStates,cssGuideLinesPainted);
|
||||
@ -1054,7 +1079,7 @@ begin
|
||||
Result:=false;
|
||||
if AComponent=nil then exit;
|
||||
if AComponent is TControl then begin
|
||||
if not ControlIsDesignerVisible(TControl(AComponent)) then begin
|
||||
if not ControlIsInDesignerVisible(TControl(AComponent)) then begin
|
||||
//writeln('not alignable: A not ControlIsDesignerVisible ',AComponent.Name);
|
||||
exit;
|
||||
end;
|
||||
@ -1072,7 +1097,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
if AComponent is TMenuItem then exit;
|
||||
if ComponentIsInvisible(AComponent) then exit;
|
||||
if Count>0 then begin
|
||||
if OnlyVisualComponentsSelected then exit;
|
||||
end;
|
||||
@ -1115,9 +1140,9 @@ begin
|
||||
MaxDist:=(CleanGridSizeX+1) div 2;
|
||||
if Abs(NearestInt.Level-0)<MaxDist then
|
||||
ImproveNearestInt(NearestInt,0);
|
||||
if (FCustomForm<>nil)
|
||||
and (Abs(NearestInt.Level-FCustomForm.ClientWidth)<MaxDist) then
|
||||
ImproveNearestInt(NearestInt,FCustomForm.ClientWidth);
|
||||
if (FForm<>nil)
|
||||
and (Abs(NearestInt.Level-FForm.ClientWidth)<MaxDist) then
|
||||
ImproveNearestInt(NearestInt,FForm.ClientWidth);
|
||||
end;
|
||||
|
||||
procedure TControlSelection.FindNearestClientTopBottom(
|
||||
@ -1127,9 +1152,9 @@ begin
|
||||
MaxDist:=(CleanGridSizeY+1) div 2;
|
||||
if Abs(NearestInt.Level-0)<MaxDist then
|
||||
ImproveNearestInt(NearestInt,0);
|
||||
if (FCustomForm<>nil)
|
||||
and (Abs(NearestInt.Level-FCustomForm.ClientHeight)<MaxDist) then
|
||||
ImproveNearestInt(NearestInt,FCustomForm.ClientHeight);
|
||||
if (FForm<>nil)
|
||||
and (Abs(NearestInt.Level-FForm.ClientHeight)<MaxDist) then
|
||||
ImproveNearestInt(NearestInt,FForm.ClientHeight);
|
||||
end;
|
||||
|
||||
procedure TControlSelection.FindNearestOldLeft(var NearestInt: TNearestInt);
|
||||
@ -1171,11 +1196,11 @@ procedure TControlSelection.FindNearestLeftGuideLine(
|
||||
var i, CurLeft, MaxDist, CurDist: integer;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FCustomForm=nil) then exit;
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FLookupRoot=nil) then exit;
|
||||
// search in all not selected components
|
||||
MaxDist:=(CleanGridSizeX+1) div 2;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
AComponent:=FCustomForm.Components[i];
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FLookupRoot.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
CurLeft:=GetParentFormRelativeTopLeft(AComponent).X;
|
||||
@ -1190,11 +1215,11 @@ procedure TControlSelection.FindNearestRightGuideLine(
|
||||
var i, CurRight, MaxDist, CurDist: integer;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FCustomForm=nil) then exit;
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FLookupRoot=nil) then exit;
|
||||
// search in all not selected components
|
||||
MaxDist:=(CleanGridSizeX+1) div 2;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
AComponent:=FCustomForm.Components[i];
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FLookupRoot.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
CurRight:=GetParentFormRelativeTopLeft(AComponent).X
|
||||
@ -1210,11 +1235,11 @@ procedure TControlSelection.FindNearestTopGuideLine(var NearestInt: TNearestInt
|
||||
var i, CurTop, MaxDist, CurDist: integer;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FCustomForm=nil) then exit;
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FLookupRoot=nil) then exit;
|
||||
// search in all not selected components
|
||||
MaxDist:=(CleanGridSizeY+1) div 2;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
AComponent:=FCustomForm.Components[i];
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FLookupRoot.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
CurTop:=GetParentFormRelativeTopLeft(AComponent).Y;
|
||||
@ -1229,11 +1254,11 @@ procedure TControlSelection.FindNearestBottomGuideLine(
|
||||
var i, CurBottom, MaxDist, CurDist: integer;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FCustomForm=nil) then exit;
|
||||
if (not EnvironmentOptions.SnapToGuideLines) or (FLookupRoot=nil) then exit;
|
||||
// search in all not selected components
|
||||
MaxDist:=(CleanGridSizeY+1) div 2;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
AComponent:=FCustomForm.Components[i];
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FLookupRoot.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
CurBottom:=GetParentFormRelativeTopLeft(AComponent).Y
|
||||
@ -1388,6 +1413,7 @@ end;
|
||||
function TControlSelection.GetLeftGuideLine(var ALine: TRect): boolean;
|
||||
var i, LineTop, LineBottom: integer;
|
||||
CRect: TRect;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if CacheGuideLines and FGuideLinesCache[glLeft].CacheValid then begin
|
||||
Result:=FGuideLinesCache[glLeft].LineValid;
|
||||
@ -1395,10 +1421,11 @@ begin
|
||||
ALine:=FGuideLinesCache[glLeft].Line;
|
||||
end else begin
|
||||
Result:=false;
|
||||
if FCustomForm=nil then exit;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
if not ComponentAlignable(FCustomForm.Components[i]) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(FCustomForm.Components[i]);
|
||||
if FForm=nil then exit;
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FLookupRoot.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(AComponent);
|
||||
if CRect.Left=FRealLeft then begin
|
||||
ALine.Left:=FRealLeft;
|
||||
ALine.Right:=ALine.Left;
|
||||
@ -1430,6 +1457,7 @@ end;
|
||||
function TControlSelection.GetRightGuideLine(var ALine: TRect): boolean;
|
||||
var i, LineTop, LineBottom: integer;
|
||||
CRect: TRect;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if CacheGuideLines and FGuideLinesCache[glRight].CacheValid then begin
|
||||
Result:=FGuideLinesCache[glRight].LineValid;
|
||||
@ -1437,10 +1465,11 @@ begin
|
||||
ALine:=FGuideLinesCache[glRight].Line;
|
||||
end else begin
|
||||
Result:=false;
|
||||
if FCustomForm=nil then exit;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
if not ComponentAlignable(FCustomForm.Components[i]) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(FCustomForm.Components[i]);
|
||||
if FLookupRoot=nil then exit;
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FForm.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(AComponent);
|
||||
if (CRect.Right=FRealLeft+FRealWidth) then begin
|
||||
ALine.Left:=CRect.Right;
|
||||
ALine.Right:=ALine.Left;
|
||||
@ -1472,6 +1501,7 @@ end;
|
||||
function TControlSelection.GetTopGuideLine(var ALine: TRect): boolean;
|
||||
var i, LineLeft, LineRight: integer;
|
||||
CRect: TRect;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if CacheGuideLines and FGuideLinesCache[glTop].CacheValid then begin
|
||||
Result:=FGuideLinesCache[glTop].LineValid;
|
||||
@ -1479,10 +1509,11 @@ begin
|
||||
ALine:=FGuideLinesCache[glTop].Line;
|
||||
end else begin
|
||||
Result:=false;
|
||||
if FCustomForm=nil then exit;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
if not ComponentAlignable(FCustomForm.Components[i]) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(FCustomForm.Components[i]);
|
||||
if FLookupRoot=nil then exit;
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FForm.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(AComponent);
|
||||
if CRect.Top=FRealTop then begin
|
||||
ALine.Top:=FRealTop;
|
||||
ALine.Bottom:=ALine.Top;
|
||||
@ -1514,6 +1545,7 @@ end;
|
||||
function TControlSelection.GetBottomGuideLine(var ALine: TRect): boolean;
|
||||
var i, LineLeft, LineRight: integer;
|
||||
CRect: TRect;
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if CacheGuideLines and FGuideLinesCache[glBottom].CacheValid then begin
|
||||
Result:=FGuideLinesCache[glBottom].LineValid;
|
||||
@ -1521,10 +1553,11 @@ begin
|
||||
ALine:=FGuideLinesCache[glBottom].Line;
|
||||
end else begin
|
||||
Result:=false;
|
||||
if FCustomForm=nil then exit;
|
||||
for i:=0 to FCustomForm.ComponentCount-1 do begin
|
||||
if not ComponentAlignable(FCustomForm.Components[i]) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(FCustomForm.Components[i]);
|
||||
if FLookupRoot=nil then exit;
|
||||
for i:=0 to FLookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=FForm.Components[i];
|
||||
if not ComponentAlignable(AComponent) then continue;
|
||||
CRect:=GetParentFormRelativeBounds(AComponent);
|
||||
if CRect.Bottom=FRealTop+FRealHeight then begin
|
||||
ALine.Top:=CRect.Bottom;
|
||||
ALine.Bottom:=ALine.Top;
|
||||
@ -1695,11 +1728,13 @@ var NewSelectedControl:TSelectedControl;
|
||||
begin
|
||||
BeginUpdate;
|
||||
NewSelectedControl:=TSelectedControl.Create(Self,AComponent);
|
||||
if NewSelectedControl.ParentForm<>FCustomForm then Clear;
|
||||
if NewSelectedControl.DesignerForm<>FForm then Clear;
|
||||
Result:=FControls.Add(NewSelectedControl);
|
||||
FStates:=FStates+[cssOnlyNonVisualNeedsUpdate,cssOnlyVisualNeedsUpdate,
|
||||
cssOnlyInvisibleNeedsUpdate,
|
||||
cssParentLevelNeedsUpdate,cssParentChildFlagsNeedUpdate];
|
||||
if Count=1 then SetCustomForm;
|
||||
if AComponent=FLookupRoot then Include(FStates,cssLookupRootSelected);
|
||||
DoChange;
|
||||
UpdateBounds;
|
||||
SaveBounds;
|
||||
@ -1732,10 +1767,14 @@ begin
|
||||
InvalidateGrabbers;
|
||||
InvalidateGuideLines;
|
||||
end;
|
||||
if Items[Index].Component=FLookupRoot then
|
||||
Exclude(FStates,cssLookupRootSelected);
|
||||
Items[Index].Free;
|
||||
FControls.Delete(Index);
|
||||
FStates:=FStates+[cssOnlyNonVisualNeedsUpdate,cssOnlyVisualNeedsUpdate,
|
||||
cssOnlyInvisibleNeedsUpdate,
|
||||
cssParentLevelNeedsUpdate,cssParentChildFlagsNeedUpdate];
|
||||
|
||||
if Count=0 then SetCustomForm;
|
||||
UpdateBounds;
|
||||
SaveBounds;
|
||||
@ -1752,8 +1791,10 @@ begin
|
||||
for i:=0 to FControls.Count-1 do Items[i].Free;
|
||||
FControls.Clear;
|
||||
FStates:=FStates+[cssOnlyNonVisualNeedsUpdate,cssOnlyVisualNeedsUpdate,
|
||||
cssParentLevelNeedsUpdate,cssParentChildFlagsNeedUpdate];
|
||||
FCustomForm:=nil;
|
||||
cssOnlyInvisibleNeedsUpdate,
|
||||
cssParentLevelNeedsUpdate,cssParentChildFlagsNeedUpdate]
|
||||
-[cssLookupRootSelected];
|
||||
FForm:=nil;
|
||||
UpdateBounds;
|
||||
SaveBounds;
|
||||
DoChange;
|
||||
@ -1915,9 +1956,9 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
if (Count=0) or (FCustomForm=nil)
|
||||
or IsSelected(FCustomForm)
|
||||
or (Items[0].Component is TMenuItem) then exit;
|
||||
if (Count=0) or (FForm=nil)
|
||||
or LookupRootSelected
|
||||
or OnlyInvisibleComponentsSelected then exit;
|
||||
|
||||
Diff:=DC.FormOrigin;
|
||||
|
||||
@ -1975,10 +2016,10 @@ var
|
||||
CompOrigin, DCOrigin: TPoint;
|
||||
begin
|
||||
if (Count<2)
|
||||
or (FCustomForm=nil)
|
||||
or (AComponent.Owner<>DC.Form)
|
||||
or (FForm=nil)
|
||||
or (AComponent=FLookupRoot)
|
||||
or (not IsSelected(AComponent))
|
||||
or (AComponent is TMenuItem) then exit;
|
||||
or ComponentIsInvisible(AComponent) then exit;
|
||||
|
||||
GetComponentBounds(AComponent,CompLeft,CompTop,CompWidth,CompHeight);
|
||||
CompOrigin:=GetParentFormRelativeParentClientOrigin(AComponent);
|
||||
@ -1986,7 +2027,7 @@ begin
|
||||
CompLeft:=CompLeft+CompOrigin.X-DCOrigin.X;
|
||||
CompTop:=CompTop+CompOrigin.Y-DCOrigin.Y;
|
||||
|
||||
{writeln('DrawMarker A ',FCustomForm.Name
|
||||
{writeln('DrawMarker A ',FForm.Name
|
||||
,' Component',AComponent.Name,',',CompLeft,',',CompLeft
|
||||
,' DCOrigin=',DCOrigin.X,',',DCOrigin.Y
|
||||
);}
|
||||
@ -2062,23 +2103,24 @@ begin
|
||||
DrawInvertFrameRect(Left-Diff.X,Top-Diff.Y,Right-Diff.X,Bottom-Diff.Y);
|
||||
end;
|
||||
|
||||
procedure TControlSelection.SelectWithRubberBand(ACustomForm:TCustomForm;
|
||||
procedure TControlSelection.SelectWithRubberBand(ALookupRoot: TComponent;
|
||||
ClearBefore, ExclusiveOr:boolean; var SelectionChanged: boolean;
|
||||
MaxParentControl: TControl);
|
||||
var i:integer;
|
||||
AComponent: TComponent;
|
||||
|
||||
function ControlInRubberBand(AComponent:TComponent):boolean;
|
||||
function ControlInRubberBand(AComponent: TComponent): boolean;
|
||||
var
|
||||
ALeft, ATop, ARight, ABottom: integer;
|
||||
Origin: TPoint;
|
||||
AControl: TControl;
|
||||
begin
|
||||
Result:=false;
|
||||
if (AComponent is TMenuItem) then exit;
|
||||
if ComponentIsInvisible(AComponent) then exit;
|
||||
if (AComponent is TControl) then begin
|
||||
AControl:=TControl(AComponent);
|
||||
// check if control is visible on form
|
||||
if not ControlIsDesignerVisible(AControl) then exit;
|
||||
if not ControlIsInDesignerVisible(AControl) then exit;
|
||||
// check if control
|
||||
if (MaxParentControl<>nil) then begin
|
||||
// select only controls, that are childs of MaxParentControl
|
||||
@ -2108,30 +2150,34 @@ var i:integer;
|
||||
begin
|
||||
SelectionChanged:=false;
|
||||
if ClearBefore then begin
|
||||
if IsSelected(ACustomForm) then begin
|
||||
Remove(ACustomForm);
|
||||
if IsSelected(ALookupRoot) then begin
|
||||
Remove(ALookupRoot);
|
||||
SelectionChanged:=true;
|
||||
end;
|
||||
for i:=0 to ACustomForm.ComponentCount-1 do
|
||||
if not ControlInRubberBand(ACustomForm.Components[i]) then begin
|
||||
if IsSelected(ACustomForm.Components[i]) then begin
|
||||
Remove(ACustomForm.Components[i]);
|
||||
for i:=0 to ALookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=ALookupRoot.Components[i];
|
||||
if not ControlInRubberBand(AComponent) then begin
|
||||
if IsSelected(AComponent) then begin
|
||||
Remove(AComponent);
|
||||
SelectionChanged:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
for i:=0 to ACustomForm.ComponentCount-1 do
|
||||
if ControlInRubberBand(ACustomForm.Components[i]) then begin
|
||||
if IsSelected(ACustomForm.Components[i]) then begin
|
||||
for i:=0 to ALookupRoot.ComponentCount-1 do begin
|
||||
AComponent:=ALookupRoot.Components[i];
|
||||
if ControlInRubberBand(AComponent) then begin
|
||||
if IsSelected(AComponent) then begin
|
||||
if ExclusiveOr then begin
|
||||
Remove(ACustomForm.Components[i]);
|
||||
Remove(AComponent);
|
||||
SelectionChanged:=true;
|
||||
end;
|
||||
end else begin
|
||||
Add(ACustomForm.Components[i]);
|
||||
Add(AComponent);
|
||||
SelectionChanged:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TControlSelection.SetRubberBandBounds(ARect:TRect);
|
||||
@ -2156,19 +2202,19 @@ begin
|
||||
or (FRubberBandBounds.Right<>ARect.Right)
|
||||
or (FRubberBandBounds.Bottom<>ARect.Bottom)
|
||||
then begin
|
||||
if (FCustomForm<>nil) and (cssRubberbandPainted in FStates) then begin
|
||||
if (FForm<>nil) and (cssRubberbandPainted in FStates) then begin
|
||||
InvFrame:=FRubberBandBounds;
|
||||
inc(InvFrame.Right);
|
||||
inc(InvFrame.Bottom);
|
||||
InvalidateFrame(FCustomForm.Handle,@InvFrame,false,1);
|
||||
InvalidateFrame(FForm.Handle,@InvFrame,false,1);
|
||||
Exclude(FStates,cssRubberbandPainted);
|
||||
end;
|
||||
FRubberBandBounds:=ARect;
|
||||
if (FCustomForm<>nil) and RubberbandActive then begin
|
||||
if (FForm<>nil) and RubberbandActive then begin
|
||||
InvFrame:=FRubberBandBounds;
|
||||
inc(InvFrame.Right);
|
||||
inc(InvFrame.Bottom);
|
||||
InvalidateFrame(FCustomForm.Handle,@InvFrame,false,1);
|
||||
InvalidateFrame(FForm.Handle,@InvFrame,false,1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -2179,7 +2225,10 @@ begin
|
||||
if cssOnlyNonVisualNeedsUpdate in FStates then begin
|
||||
Result:=true;
|
||||
for i:=0 to FControls.Count-1 do
|
||||
Result:=Result and (not (Items[i].Component is TControl));
|
||||
if Items[i].IsTControl then begin
|
||||
Result:=false;
|
||||
break;
|
||||
end;
|
||||
if Result then
|
||||
Include(FStates,cssOnlyNonVisualSelected)
|
||||
else
|
||||
@ -2195,7 +2244,10 @@ begin
|
||||
if cssOnlyVisualNeedsUpdate in FStates then begin
|
||||
Result:=true;
|
||||
for i:=0 to FControls.Count-1 do
|
||||
Result:=Result and (Items[i].Component is TControl);
|
||||
if not Items[i].IsTControl then begin
|
||||
Result:=false;
|
||||
break;
|
||||
end;
|
||||
if Result then
|
||||
Include(FStates,cssOnlyVisualNeedsSelected)
|
||||
else
|
||||
@ -2205,6 +2257,30 @@ begin
|
||||
Result:=cssOnlyVisualNeedsSelected in FStates;
|
||||
end;
|
||||
|
||||
function TControlSelection.OnlyInvisibleComponentsSelected: boolean;
|
||||
var i: integer;
|
||||
begin
|
||||
if cssOnlyInvisibleNeedsUpdate in FStates then begin
|
||||
Result:=true;
|
||||
for i:=0 to FControls.Count-1 do
|
||||
if not ComponentIsInvisible(Items[i].Component) then begin
|
||||
Result:=false;
|
||||
break;
|
||||
end;
|
||||
if Result then
|
||||
Include(FStates,cssOnlyInvisibleSelected)
|
||||
else
|
||||
Exclude(FStates,cssOnlyInvisibleSelected);
|
||||
Exclude(FStates,cssOnlyInvisibleNeedsUpdate);
|
||||
end else
|
||||
Result:=cssOnlyInvisibleSelected in FStates;
|
||||
end;
|
||||
|
||||
function TControlSelection.LookupRootSelected: boolean;
|
||||
begin
|
||||
Result:=cssLookupRootSelected in FStates;
|
||||
end;
|
||||
|
||||
function TControlSelection.CompareInts(i1, i2: integer): integer;
|
||||
begin
|
||||
if i1<i2 then Result:=-1
|
||||
@ -2279,7 +2355,7 @@ begin
|
||||
csaSides1, csaCenters, csaSides2, csaCenterInWindow:
|
||||
begin
|
||||
HorCenter:=(ALeft+ARight) div 2;
|
||||
HorDiff:=(FCustomForm.Width div 2)-HorCenter;
|
||||
HorDiff:=(FForm.Width div 2)-HorCenter;
|
||||
for i:=0 to FControls.Count-1 do begin
|
||||
if Items[i].IsTopLvl then continue;
|
||||
case HorizAlignment of
|
||||
@ -2330,7 +2406,7 @@ begin
|
||||
csaSides1, csaCenters, csaSides2, csaCenterInWindow:
|
||||
begin
|
||||
VertCenter:=(ATop+ABottom) div 2;
|
||||
VertDiff:=(FCustomForm.Height div 2)-VertCenter;
|
||||
VertDiff:=(FForm.Height div 2)-VertCenter;
|
||||
for i:=0 to FControls.Count-1 do begin
|
||||
if Items[i].IsTopLvl then continue;
|
||||
case VertAlignment of
|
||||
@ -2537,7 +2613,7 @@ var
|
||||
Line: array[TGuideLineType] of TRect;
|
||||
g: TGuideLineType;
|
||||
begin
|
||||
if (Count=0) or (FCustomForm=nil) or Items[0].IsTopLvl then exit;
|
||||
if (Count=0) or (FForm=nil) or LookupRootSelected then exit;
|
||||
LineExists[glLeft]:=GetLeftGuideLine(Line[glLeft]);
|
||||
LineExists[glRight]:=GetRightGuideLine(Line[glRight]);
|
||||
LineExists[glTop]:=GetTopGuideLine(Line[glTop]);
|
||||
@ -2580,6 +2656,8 @@ var a, b: integer;
|
||||
Changed: boolean;
|
||||
begin
|
||||
Changed:=false;
|
||||
// bubble sort: slow, but the selection is rarely bigger than few dozens
|
||||
// and does not change very often
|
||||
for a:=0 to FControls.Count-1 do begin
|
||||
for b:=a+1 to FControls.Count-1 do begin
|
||||
if SortProc(a,b)>0 then begin
|
||||
@ -2593,4 +2671,18 @@ begin
|
||||
if Changed then DoChange;
|
||||
end;
|
||||
|
||||
function TControlSelection.GetSelectionOwner: TComponent;
|
||||
var
|
||||
AComponent: TComponent;
|
||||
begin
|
||||
if FControls.Count>0 then begin
|
||||
AComponent:=Items[0].Component;
|
||||
if AComponent.Owner<>nil then
|
||||
Result:=AComponent.Owner
|
||||
else
|
||||
Result:=AComponent;
|
||||
end else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -33,7 +33,8 @@ unit DesignerProcs;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLLinux, Forms, Controls, LCLType, Graphics, VCLGlobals;
|
||||
Classes, SysUtils, LCLLinux, Forms, Controls, LCLType, Graphics, VCLGlobals,
|
||||
Menus;
|
||||
|
||||
type
|
||||
TDesignerDCFlag = (ddcDCOriginValid, ddcFormOriginValid,
|
||||
@ -79,6 +80,19 @@ const
|
||||
NonVisualCompBorder = 2;
|
||||
NonVisualCompWidth = NonVisualCompIconWidth+2*NonVisualCompBorder;
|
||||
|
||||
|
||||
type
|
||||
TGetDesignerFormEvent =
|
||||
function(AComponent: TComponent): TCustomForm of object;
|
||||
|
||||
var
|
||||
OnGetDesignerForm: TGetDesignerFormEvent;
|
||||
|
||||
function GetDesignerForm(AComponent: TComponent): TCustomForm;
|
||||
function GetParentLevel(AControl: TControl): integer;
|
||||
function ControlIsInDesignerVisible(AControl: TControl): boolean;
|
||||
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
||||
|
||||
function GetParentFormRelativeTopLeft(Component: TComponent): TPoint;
|
||||
function GetParentFormRelativeBounds(Component: TComponent): TRect;
|
||||
function GetParentFormRelativeClientOrigin(Component: TComponent): TPoint;
|
||||
@ -86,7 +100,6 @@ function GetParentFormRelativeParentClientOrigin(Component: TComponent): TPoint;
|
||||
|
||||
function GetFormRelativeMousePosition(Form: TCustomForm): TPoint;
|
||||
|
||||
function ComponentIsTopLvl(AComponent: TComponent): boolean;
|
||||
procedure GetComponentBounds(AComponent: TComponent;
|
||||
var Left, Top, Width, Height: integer);
|
||||
function GetComponentLeft(AComponent: TComponent): integer;
|
||||
@ -94,9 +107,6 @@ function GetComponentTop(AComponent: TComponent): integer;
|
||||
function GetComponentWidth(AComponent: TComponent): integer;
|
||||
function GetComponentHeight(AComponent: TComponent): integer;
|
||||
|
||||
function GetParentLevel(AControl: TControl): integer;
|
||||
|
||||
function ControlIsDesignerVisible(AControl: TControl): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -189,12 +199,6 @@ begin
|
||||
dec(Result.Y,FormClientOrigin.Y);
|
||||
end;
|
||||
|
||||
function ComponentIsTopLvl(AComponent: TComponent): boolean;
|
||||
begin
|
||||
Result:=(AComponent<>nil) and (AComponent is TControl)
|
||||
and (TControl(AComponent).Parent=nil);
|
||||
end;
|
||||
|
||||
procedure GetComponentBounds(AComponent: TComponent;
|
||||
var Left, Top, Width, Height: integer);
|
||||
begin
|
||||
@ -256,7 +260,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ControlIsDesignerVisible(AControl: TControl): boolean;
|
||||
function ControlIsInDesignerVisible(AControl: TControl): boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
while AControl<>nil do begin
|
||||
@ -268,6 +272,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
||||
begin
|
||||
Result:=(AComponent is TMenuItem);
|
||||
end;
|
||||
|
||||
function GetDesignerForm(AComponent: TComponent): TCustomForm;
|
||||
var
|
||||
Owner: TComponent;
|
||||
begin
|
||||
Result:=nil;
|
||||
if Assigned(OnGetDesignerForm) then
|
||||
Result:=OnGetDesignerForm(AComponent)
|
||||
else begin
|
||||
Owner:=AComponent.Owner;
|
||||
if Owner is TCustomForm then Result:=TCustomForm(Owner);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TDesignerDeviceContext }
|
||||
|
||||
function TDesignerDeviceContext.GetDCOrigin: TPoint;
|
||||
@ -372,5 +394,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
OnGetDesignerForm:=nil;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -38,13 +38,11 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, LResources,
|
||||
StdCtrls, Buttons, ExtCtrls, LMessages, DesignerMenu, Menus, GraphType,
|
||||
PropEdits, ComponentEditors, Designer, LazarusIDEStrConsts;
|
||||
ComponentEditors, Designer, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
|
||||
TMainMenuEditorForm = class(TForm)
|
||||
procedure OnComponentDeleting(AComponent: TComponent);
|
||||
procedure OnComponentsModified(Sender: TObject);
|
||||
private
|
||||
fDesignerMainMenu: TDesignerMainMenu;
|
||||
fPanel: TPanel;
|
||||
@ -84,41 +82,6 @@ implementation
|
||||
|
||||
{ TMainMenuEditorForm }
|
||||
|
||||
procedure TMainMenuEditorForm.OnComponentDeleting(AComponent: TComponent);
|
||||
begin
|
||||
if (AComponent=nil) then exit;
|
||||
if AComponent is TMenu then begin
|
||||
writeln('TMainMenuEditorForm.OnComponentDeleting ',AComponent.Name,':',AComponent.ClassName);
|
||||
|
||||
end else if AComponent is TMenuItem then begin
|
||||
writeln('TMainMenuEditorForm.OnComponentDeleting ',AComponent.Name,':',AComponent.ClassName);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainMenuEditorForm.OnComponentsModified(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
SelectedComponents: TComponentSelectionList;
|
||||
begin
|
||||
if GlobalDesignHook.LookupRoot=nil then exit;
|
||||
SelectedComponents:=TComponentSelectionList.Create;
|
||||
try
|
||||
GlobalDesignHook.GetSelectedComponents(SelectedComponents);
|
||||
for i:=0 to SelectedComponents.Count-1 do begin
|
||||
if (SelectedComponents[i] is TMenu) then begin
|
||||
writeln('TMainMenuEditorForm.OnComponentsModified ',SelectedComponents[i].Name,':',SelectedComponents[i].ClassName);
|
||||
|
||||
end else if (SelectedComponents[i] is TMenuItem) then begin
|
||||
writeln('TMainMenuEditorForm.OnComponentsModified ',SelectedComponents[i].Name,':',SelectedComponents[i].ClassName);
|
||||
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
SelectedComponents.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TMainMenuEditorForm.CreateWithMenu(aOwner: TComponent; aMenu: TMenu;
|
||||
aEditor: TComponentEditor; aDesigner: TDesigner);
|
||||
var
|
||||
@ -139,11 +102,6 @@ begin
|
||||
|
||||
|
||||
DesignerMainMenu:=TDesignerMainMenu.CreateWithMenu(Self, fMenu, fEditor);
|
||||
|
||||
GlobalDesignHook.AddHandlerComponentDeleting(@OnComponentDeleting);
|
||||
GlobalDesignHook.AddHandlerModified(@OnComponentsModified);
|
||||
|
||||
//PopupMenu:=DesignerPopupMenu;
|
||||
|
||||
Cmp2:=TScrollBox.Create(self);
|
||||
with Cmp2 do
|
||||
@ -220,7 +178,6 @@ end;
|
||||
|
||||
destructor TMainMenuEditorForm.Destroy;
|
||||
begin
|
||||
GlobalDesignHook.RemoveAllHandlersForObject(Self);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -268,7 +225,8 @@ end;
|
||||
|
||||
{ TMainMenuComponentEditor}
|
||||
|
||||
constructor TMainMenuComponentEditor.Create(AComponent: TComponent; aDesigner: TComponentEditorDesigner);
|
||||
constructor TMainMenuComponentEditor.Create(AComponent: TComponent;
|
||||
aDesigner: TComponentEditorDesigner);
|
||||
begin
|
||||
inherited Create(AComponent,ADesigner);
|
||||
fDesigner:=TDesigner(aDesigner);
|
||||
|
@ -76,10 +76,32 @@ type
|
||||
property DataModule: TDataModule read GetDataModule write SetDataModule;
|
||||
end;
|
||||
|
||||
function CompareNonControlForms(Data1, Data2: Pointer): integer;
|
||||
function CompareLookupRootAndNonControlForm(Key, Data: Pointer): integer;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function CompareNonControlForms(Data1, Data2: Pointer): integer;
|
||||
var
|
||||
Form1: TNonControlForm;
|
||||
Form2: TNonControlForm;
|
||||
begin
|
||||
Form1:=TNonControlForm(Data1);
|
||||
Form2:=TNonControlForm(Data2);
|
||||
Result:=integer(Form1.LookupRoot)-integer(Form2.LookupRoot);
|
||||
end;
|
||||
|
||||
function CompareLookupRootAndNonControlForm(Key, Data: Pointer): integer;
|
||||
var
|
||||
LookupRoot: TComponent;
|
||||
Form: TNonControlForm;
|
||||
begin
|
||||
LookupRoot:=TComponent(Key);
|
||||
Form:=TNonControlForm(Data);
|
||||
Result:=integer(LookupRoot)-integer(Form.LookupRoot);
|
||||
end;
|
||||
|
||||
{ TNonControlForm }
|
||||
|
||||
procedure TNonControlForm.SetLookupRoot(const AValue: TComponent);
|
||||
@ -101,6 +123,7 @@ constructor TNonControlForm.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FFrameWidth:=1;
|
||||
ControlStyle:=ControlStyle-[csAcceptsControls];
|
||||
end;
|
||||
|
||||
destructor TNonControlForm.Destroy;
|
||||
|
@ -39,8 +39,8 @@ uses
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, AbstractFormeditor, Controls, PropEdits, TypInfo, ObjectInspector,
|
||||
Forms, Menus, JITForms, NonControlForms, ComponentReg, IDEProcs,
|
||||
ComponentEditors, KeyMapping, EditorOptions, Dialogs;
|
||||
Forms, Menus, Dialogs, AVL_Tree, JITForms, NonControlForms, ComponentReg,
|
||||
IDEProcs, ComponentEditors, KeyMapping, EditorOptions, Designerprocs;
|
||||
|
||||
Const OrdinalTypes = [tkInteger,tkChar,tkENumeration,tkbool];
|
||||
|
||||
@ -104,50 +104,45 @@ each control that's dropped onto the form
|
||||
property Component : TComponent read FComponent;
|
||||
end;
|
||||
|
||||
{
|
||||
TCustomFormEditor
|
||||
|
||||
}
|
||||
{ TCustomFormEditor }
|
||||
|
||||
TControlClass = class of TControl;
|
||||
|
||||
TCustomFormEditor = class(TAbstractFormEditor)
|
||||
private
|
||||
FModified : Boolean;
|
||||
FComponentInterfaceList: TList; //used to track and find controls
|
||||
FComponentInterfaces: TAVLTree; // tree of TComponentInterface sorted for
|
||||
// component
|
||||
FSelectedComponents: TComponentSelectionList;
|
||||
FObj_Inspector: TObjectInspector;
|
||||
function GetPropertyEditorHook: TPropertyEditorHook;
|
||||
protected
|
||||
Procedure RemoveFromComponentInterfaceList(Value :TIComponentInterface);
|
||||
FNonControlForms: TAVLTree; // tree of TNonControlForm sorted for LookupRoot
|
||||
procedure SetSelectedComponents(TheSelectedComponents : TComponentSelectionList);
|
||||
procedure OnObjectInspectorModified(Sender: TObject);
|
||||
procedure SetObj_Inspector(AnObjectInspector: TObjectInspector); virtual;
|
||||
procedure JITListReaderError(Sender: TObject; ErrorType: TJITFormError;
|
||||
var Action: TModalResult); virtual;
|
||||
|
||||
Function GetComponentByHandle(const Value : Longint): TIComponentInterface; override;
|
||||
|
||||
Function GetSelCount : Integer; override;
|
||||
Function GetSelComponent(Index : Integer) : TIComponentInterface; override;
|
||||
procedure OnDesignerMenuItemClick(Sender: TObject); virtual;
|
||||
function FindNonControlFormNode(LookupRoot: TComponent): TAVLTreeNode;
|
||||
public
|
||||
JITFormList: TJITForms;// designed forms
|
||||
JITDataModuleList: TJITDataModules;// designed data modules
|
||||
|
||||
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
|
||||
Function AddSelected(Value : TComponent) : Integer;
|
||||
Procedure DeleteControl(AComponent: TComponent; FreeComponent: boolean);
|
||||
Function FormModified : Boolean; override;
|
||||
Function FindComponentByName(const Name : ShortString) : TIComponentInterface; override;
|
||||
Function FindComponent(AComponent: TComponent): TIComponentInterface; override;
|
||||
function IsJITComponent(AComponent: TComponent): boolean;
|
||||
function GetJITListOfType(AncestorType: TComponentClass): TJITComponentList;
|
||||
function GetDesignerForm(AComponent: TComponent): TCustomForm;
|
||||
function FindNonControlForm(LookupRoot: TComponent): TNonControlForm;
|
||||
|
||||
function GetComponentEditor(AComponent: TComponent): TBaseComponentEditor;
|
||||
Function GetFormComponent: TIComponentInterface; override;
|
||||
function CreateUniqueComponentName(AComponent: TComponent): string;
|
||||
function CreateUniqueComponentName(const AClassName: string;
|
||||
OwnerComponent: TComponent): string;
|
||||
@ -164,12 +159,15 @@ TCustomFormEditor
|
||||
function TranslateKeyToDesignerCommand(Key: word; Shift: TShiftState): integer;
|
||||
public
|
||||
property SelectedComponents: TComponentSelectionList
|
||||
read FSelectedComponents write SetSelectedComponents;
|
||||
read FSelectedComponents write SetSelectedComponents;
|
||||
property Obj_Inspector: TObjectInspector
|
||||
read FObj_Inspector write SetObj_Inspector;
|
||||
read FObj_Inspector write SetObj_Inspector;
|
||||
property PropertyEditorHook: TPropertyEditorHook read GetPropertyEditorHook;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function CompareComponentInterfaces(Data1, Data2: Pointer): integer;
|
||||
function CompareComponentAndInterface(Key, Data: Pointer): integer;
|
||||
|
||||
implementation
|
||||
|
||||
@ -177,6 +175,26 @@ implementation
|
||||
uses
|
||||
SysUtils, Math;
|
||||
|
||||
function CompareComponentInterfaces(Data1, Data2: Pointer): integer;
|
||||
var
|
||||
CompIntf1: TComponentInterface;
|
||||
CompIntf2: TComponentInterface;
|
||||
begin
|
||||
CompIntf1:=TComponentInterface(Data1);
|
||||
CompIntf2:=TComponentInterface(Data2);
|
||||
Result:=integer(CompIntf1.Component)-integer(CompIntf2.Component);
|
||||
end;
|
||||
|
||||
function CompareComponentAndInterface(Key, Data: Pointer): integer;
|
||||
var
|
||||
AComponent: TComponent;
|
||||
CompIntf: TComponentInterface;
|
||||
begin
|
||||
AComponent:=TComponent(Key);
|
||||
CompIntf:=TComponentInterface(Data);
|
||||
Result:=integer(AComponent)-integer(CompIntf.Component);
|
||||
end;
|
||||
|
||||
{TComponentInterface}
|
||||
|
||||
constructor TComponentInterface.Create;
|
||||
@ -620,7 +638,8 @@ end;
|
||||
constructor TCustomFormEditor.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FComponentInterfaceList := TList.Create;
|
||||
FComponentInterfaces := TAVLTree.Create(@CompareComponentInterfaces);
|
||||
FNonControlForms:=TAVLTree.Create(@CompareNonControlForms);
|
||||
FSelectedComponents := TComponentSelectionList.Create;
|
||||
|
||||
JITFormList := TJITForms.Create;
|
||||
@ -630,6 +649,7 @@ begin
|
||||
JITDataModuleList.OnReaderError:=@JITListReaderError;
|
||||
|
||||
DesignerMenuItemClick:=@OnDesignerMenuItemClick;
|
||||
OnGetDesignerForm:=@GetDesignerForm;
|
||||
end;
|
||||
|
||||
destructor TCustomFormEditor.Destroy;
|
||||
@ -637,8 +657,9 @@ begin
|
||||
DesignerMenuItemClick:=nil;
|
||||
JITFormList.Free;
|
||||
JITDataModuleList.Free;
|
||||
FComponentInterfaceList.Free;
|
||||
FComponentInterfaces.Free;
|
||||
FSelectedComponents.Free;
|
||||
FNonControlForms.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -672,13 +693,15 @@ Procedure TCustomFormEditor.DeleteControl(AComponent: TComponent;
|
||||
var
|
||||
Temp : TComponentInterface;
|
||||
i: integer;
|
||||
AForm: TCustomForm;
|
||||
Begin
|
||||
Temp := TComponentInterface(FindComponent(AComponent));
|
||||
if Temp <> nil then
|
||||
begin
|
||||
RemoveFromComponentInterfaceList(Temp);
|
||||
FComponentInterfaces.Remove(Temp);
|
||||
|
||||
writeln('TCustomFormEditor.DeleteControl ',AComponent.ClassName,' ',IsJITComponent(AComponent));
|
||||
writeln('TCustomFormEditor.DeleteControl ',
|
||||
AComponent.ClassName,' ',IsJITComponent(AComponent));
|
||||
if IsJITComponent(AComponent) then begin
|
||||
// value is a top level component
|
||||
if FreeComponent then begin
|
||||
@ -692,11 +715,19 @@ writeln('TCustomFormEditor.DeleteControl ',AComponent.ClassName,' ',IsJITCompone
|
||||
if PropertyEditorHook.LookupRoot=AComponent then
|
||||
PropertyEditorHook.LookupRoot:=nil;
|
||||
if JITFormList.IsJITForm(AComponent) then
|
||||
// free a form component
|
||||
JITFormList.DestroyJITComponent(AComponent)
|
||||
else if JITDataModuleList.IsJITDataModule(AComponent) then
|
||||
JITDataModuleList.DestroyJITComponent(AComponent)
|
||||
else
|
||||
RaiseException('TCustomFormEditor.AddSelected '+AComponent.ClassName);
|
||||
else if JITDataModuleList.IsJITDataModule(AComponent) then begin
|
||||
// free a datamodule and its designer form
|
||||
AForm:=GetDesignerForm(AComponent);
|
||||
if not (AForm is TNonControlForm) then
|
||||
RaiseException('TCustomFormEditor.DeleteControl Where is the TNonControlForm? '+AComponent.ClassName);
|
||||
FNonControlForms.Remove(AForm);
|
||||
TNonControlForm(AForm).LookupRoot:=nil;
|
||||
AForm.Free;
|
||||
JITDataModuleList.DestroyJITComponent(AComponent);
|
||||
end else
|
||||
RaiseException('TCustomFormEditor.DeleteControl '+AComponent.ClassName);
|
||||
end;
|
||||
Temp.Free;
|
||||
end
|
||||
@ -710,39 +741,32 @@ writeln('TCustomFormEditor.DeleteControl ',AComponent.ClassName,' ',IsJITCompone
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.FormModified : Boolean;
|
||||
Begin
|
||||
Result := FModified;
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.FindComponentByName(
|
||||
const Name : ShortString) : TIComponentInterface;
|
||||
const Name: ShortString) : TIComponentInterface;
|
||||
Var
|
||||
Num : Integer;
|
||||
ANode: TAVLTreeNode;
|
||||
Begin
|
||||
Num := 0;
|
||||
While Num < FComponentInterfaceList.Count do
|
||||
Begin
|
||||
Result := TIComponentInterface(FComponentInterfaceList.Items[Num]);
|
||||
ANode:=FComponentInterfaces.FindLowest;
|
||||
while ANode<>nil do begin
|
||||
Result := TIComponentInterface(ANode.Data);
|
||||
if AnsiCompareText(TComponentInterface(Result).Component.Name,Name)=0 then
|
||||
exit;
|
||||
inc(num);
|
||||
ANode:=FComponentInterfaces.FindSuccessor(ANode);
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.FindComponent(AComponent:TComponent): TIComponentInterface;
|
||||
Function TCustomFormEditor.FindComponent(AComponent: TComponent
|
||||
): TIComponentInterface;
|
||||
Var
|
||||
Num : Integer;
|
||||
ANode: TAVLTreeNode;
|
||||
Begin
|
||||
Num := 0;
|
||||
While Num < FComponentInterfaceList.Count do
|
||||
Begin
|
||||
Result := TIComponentInterface(FComponentInterfaceList.Items[Num]);
|
||||
if TComponentInterface(Result).Component = AComponent then exit;
|
||||
inc(num);
|
||||
end;
|
||||
Result:=nil;
|
||||
ANode:=FComponentInterfaces.FindKey(Pointer(AComponent),
|
||||
@CompareComponentAndInterface);
|
||||
if ANode<>nil then
|
||||
Result:=TIComponentInterface(ANode.Data)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.IsJITComponent(AComponent: TComponent): boolean;
|
||||
@ -762,6 +786,31 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetDesignerForm(AComponent: TComponent
|
||||
): TCustomForm;
|
||||
var
|
||||
OwnerComponent: TComponent;
|
||||
begin
|
||||
Result:=nil;
|
||||
OwnerComponent:=AComponent.Owner;
|
||||
if OwnerComponent is TCustomForm then
|
||||
Result:=TCustomForm(OwnerComponent)
|
||||
else
|
||||
Result:=FindNonControlForm(OwnerComponent);
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.FindNonControlForm(LookupRoot: TComponent
|
||||
): TNonControlForm;
|
||||
var
|
||||
AVLNode: TAVLTreeNode;
|
||||
begin
|
||||
AVLNode:=FindNonControlFormNode(LookupRoot);
|
||||
if AVLNode<>nil then
|
||||
Result:=TNonControlForm(AVLNode.Data)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetComponentEditor(AComponent: TComponent
|
||||
): TBaseComponentEditor;
|
||||
var
|
||||
@ -790,13 +839,13 @@ Begin
|
||||
Temp := TComponentInterface.Create;
|
||||
|
||||
OwnerComponent:=nil;
|
||||
if Assigned(ParentCI) and ParentCI.IsTControl then
|
||||
if Assigned(ParentCI) then
|
||||
begin
|
||||
// add as child control
|
||||
ParentComponent:=TComponentInterface(ParentCI).Component;
|
||||
OwnerComponent:=GetParentForm(TControl(ParentComponent));
|
||||
if OwnerComponent=nil then
|
||||
OwnerComponent:=ParentComponent;
|
||||
OwnerComponent:=ParentComponent;
|
||||
if OwnerComponent.Owner<>nil then
|
||||
OwnerComponent:=OwnerComponent.Owner;
|
||||
Temp.FComponent := TypeClass.Create(OwnerComponent);
|
||||
// set parent
|
||||
if Temp.IsTControl then begin
|
||||
@ -883,7 +932,7 @@ Begin
|
||||
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TCustomFormEditor.CreateComponent F ');{$ENDIF}
|
||||
// add to component list
|
||||
FComponentInterfaceList.Add(Temp);
|
||||
FComponentInterfaces.Add(Temp);
|
||||
|
||||
Result := Temp;
|
||||
end;
|
||||
@ -967,24 +1016,6 @@ begin
|
||||
Action:=MessageDlg(aCaption,aMsg,DlgType,Buttons,HelpCtx);
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetComponentByHandle(const Value: Longint
|
||||
): TIComponentInterface;
|
||||
begin
|
||||
// ToDo:
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetSelCount: Integer;
|
||||
begin
|
||||
Result:=FComponentInterfaceList.Count;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetSelComponent(Index: Integer
|
||||
): TIComponentInterface;
|
||||
begin
|
||||
Result:=TIComponentInterface(FComponentInterfaceList[Index]);
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.OnDesignerMenuItemClick(Sender: TObject);
|
||||
var
|
||||
CompEditor: TBaseComponentEditor;
|
||||
@ -1010,23 +1041,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.FindNonControlFormNode(LookupRoot: TComponent
|
||||
): TAVLTreeNode;
|
||||
begin
|
||||
Result:=FNonControlForms.FindKey(Pointer(LookupRoot),
|
||||
@CompareLookupRootAndNonControlForm);
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.GetPropertyEditorHook: TPropertyEditorHook;
|
||||
begin
|
||||
Result:=Obj_Inspector.PropertyEditorHook;
|
||||
end;
|
||||
|
||||
Procedure TCustomFormEditor.RemoveFromComponentInterfaceList(
|
||||
Value :TIComponentInterface);
|
||||
Begin
|
||||
FComponentInterfaceList.Remove(Value);
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.GetFormComponent : TIComponentInterface;
|
||||
Begin
|
||||
//this can only be used IF you have one FormEditor per form. I currently don't
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.CreateUniqueComponentName(AComponent: TComponent
|
||||
): string;
|
||||
begin
|
||||
@ -1078,7 +1104,7 @@ Function TCustomFormEditor.CreateComponentInterface(
|
||||
AComponent: TComponent): TIComponentInterface;
|
||||
Begin
|
||||
Result := TComponentInterface.Create(AComponent);
|
||||
FComponentInterfaceList.Add(Result);
|
||||
FComponentInterfaces.Add(Result);
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.OnObjectInspectorModified(Sender: TObject);
|
||||
|
460
ide/project.pp
460
ide/project.pp
@ -66,6 +66,14 @@ type
|
||||
XMLConfig: TXMLConfig) of object;
|
||||
TOnSaveProjectInfo = procedure(TheProject: TProject;
|
||||
XMLConfig: TXMLConfig) of object;
|
||||
|
||||
TUnitInfoList = (
|
||||
uilPartOfProject,
|
||||
uilWithEditorIndex,
|
||||
uilWithComponent,
|
||||
uilLoaded,
|
||||
uilAutoRevertLocked
|
||||
);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
TUnitInfo = class(TObject)
|
||||
@ -90,11 +98,10 @@ type
|
||||
fIsPartOfProject: boolean;
|
||||
fLoaded: Boolean; // loaded in the source editor
|
||||
fModified: boolean;
|
||||
fNextPartOfProject: TUnitInfo;
|
||||
fNext, fPrev: array[TUnitInfoList] of TUnitInfo;
|
||||
fOnFileBackup: TOnFileBackup;
|
||||
fOnLoadSaveFilename: TOnLoadSaveFilename;
|
||||
fOnUnitNameChange: TOnUnitNameChange;
|
||||
fPrevPartOfProject: TUnitInfo;
|
||||
FProject: TProject;
|
||||
FResourceFilename: string;
|
||||
fSource: TCodeBuffer;
|
||||
@ -106,6 +113,16 @@ type
|
||||
|
||||
function GetFileName: string;
|
||||
function GetHasResources:boolean;
|
||||
function GetNextAutoRevertLockedUnit: TUnitInfo;
|
||||
function GetNextLoadedUnit: TUnitInfo;
|
||||
function GetNextPartOfProject: TUnitInfo;
|
||||
function GetNextUnitWithComponent: TUnitInfo;
|
||||
function GetNextUnitWithEditorIndex: TUnitInfo;
|
||||
function GetPrevAutoRevertLockedUnit: TUnitInfo;
|
||||
function GetPrevLoadedUnit: TUnitInfo;
|
||||
function GetPrevPartOfProject: TUnitInfo;
|
||||
function GetPrevUnitWithComponent: TUnitInfo;
|
||||
function GetPrevUnitWithEditorIndex: TUnitInfo;
|
||||
procedure SetEditorIndex(const AValue: integer);
|
||||
procedure SetFileReadOnly(const AValue: Boolean);
|
||||
procedure SetComponent(const AValue: TComponent);
|
||||
@ -116,19 +133,7 @@ type
|
||||
procedure SetUnitName(const NewUnitName:string);
|
||||
procedure SetUserReadOnly(const NewValue: boolean);
|
||||
protected
|
||||
fNextUnitWithEditorIndex: TUnitInfo;
|
||||
fPrevUnitWithEditorIndex: TUnitInfo;
|
||||
fNextUnitWithComponent: TUnitInfo;
|
||||
fPrevUnitWithComponent: TUnitInfo;
|
||||
fNextLoadedUnit: TUnitInfo;
|
||||
fPrevLoadedUnit: TUnitInfo;
|
||||
fNextAutoRevertLockedUnit: TUnitInfo;
|
||||
fPrevAutoRevertLockedUnit: TUnitInfo;
|
||||
procedure UpdateEditorIndexList;
|
||||
procedure UpdateComponentList;
|
||||
procedure UpdateLoadedList;
|
||||
procedure UpdateAutoRevertLockedList;
|
||||
procedure UpdatePartOfProjectList;
|
||||
procedure UpdateList(ListType: TUnitInfoList; Add: boolean);
|
||||
public
|
||||
constructor Create(ACodeBuffer: TCodeBuffer);
|
||||
destructor Destroy; override;
|
||||
@ -157,17 +162,17 @@ type
|
||||
|
||||
{ Properties }
|
||||
public
|
||||
// Unit views
|
||||
property NextUnitWithEditorIndex: TUnitInfo read fNextUnitWithEditorIndex;
|
||||
property PrevUnitWithEditorIndex: TUnitInfo read fPrevUnitWithEditorIndex;
|
||||
property NextUnitWithComponent: TUnitInfo read fNextUnitWithComponent;
|
||||
property PrevUnitWithComponent: TUnitInfo read fPrevUnitWithComponent;
|
||||
property NextLoadedUnit: TUnitInfo read fNextLoadedUnit;
|
||||
property PrevLoadedUnit: TUnitInfo read fPrevLoadedUnit;
|
||||
property NextAutoRevertLockedUnit: TUnitInfo read fNextAutoRevertLockedUnit;
|
||||
property PrevAutoRevertLockedUnit: TUnitInfo read fPrevAutoRevertLockedUnit;
|
||||
property NextPartOfProject: TUnitInfo read fNextPartOfProject;
|
||||
property PrevPartOfProject: TUnitInfo read fPrevPartOfProject;
|
||||
// Unit lists
|
||||
property NextUnitWithEditorIndex: TUnitInfo read GetNextUnitWithEditorIndex;
|
||||
property PrevUnitWithEditorIndex: TUnitInfo read GetPrevUnitWithEditorIndex;
|
||||
property NextUnitWithComponent: TUnitInfo read GetNextUnitWithComponent;
|
||||
property PrevUnitWithComponent: TUnitInfo read GetPrevUnitWithComponent;
|
||||
property NextLoadedUnit: TUnitInfo read GetNextLoadedUnit;
|
||||
property PrevLoadedUnit: TUnitInfo read GetPrevLoadedUnit;
|
||||
property NextAutoRevertLockedUnit: TUnitInfo read GetNextAutoRevertLockedUnit;
|
||||
property PrevAutoRevertLockedUnit: TUnitInfo read GetPrevAutoRevertLockedUnit;
|
||||
property NextPartOfProject: TUnitInfo read GetNextPartOfProject;
|
||||
property PrevPartOfProject: TUnitInfo read GetPrevPartOfProject;
|
||||
public
|
||||
property Bookmarks: TFileBookmarks read FBookmarks write FBookmarks;
|
||||
property CursorPos: TPoint read fCursorPos write fCursorPos;
|
||||
@ -277,13 +282,11 @@ type
|
||||
fChanged: boolean;
|
||||
fCompilerOptions: TProjectCompilerOptions;
|
||||
FDefineTemplates: TProjectDefineTemplates;
|
||||
fFirstAutoRevertLockedUnit: TUnitInfo; // units with IsAutoRevertLocked=true
|
||||
fFirstLoadedUnit: TUnitInfo; // units with Loaded=true
|
||||
fFirstPartOfProject: TUnitInfo; // units with IsPartOfProject=true
|
||||
|
||||
FFirstRemovedDependency: TPkgDependency;
|
||||
FFirstRequiredDependency: TPkgDependency;
|
||||
fFirstUnitWithEditorIndex: TUnitInfo; // units with EditorIndex>=0
|
||||
fFirstUnitWithComponent: TUnitInfo; // units with Component<>nil
|
||||
fFirst: array[TUnitInfoList] of TUnitInfo;
|
||||
|
||||
FFlags: TProjectFlags;
|
||||
fIconPath: String;
|
||||
fJumpHistory: TProjectJumpHistory;
|
||||
@ -306,6 +309,11 @@ type
|
||||
fUnitList: TList; // list of _all_ units (TUnitInfo)
|
||||
FUpdateLock: integer;
|
||||
xmlconfig: TXMLConfig;
|
||||
function GetFirstAutoRevertLockedUnit: TUnitInfo;
|
||||
function GetFirstLoadedUnit: TUnitInfo;
|
||||
function GetFirstPartOfProject: TUnitInfo;
|
||||
function GetFirstUnitWithComponent: TUnitInfo;
|
||||
function GetFirstUnitWithEditorIndex: TUnitInfo;
|
||||
function GetMainFilename: String;
|
||||
function GetMainUnitInfo: TUnitInfo;
|
||||
function GetProjectInfoFile: string;
|
||||
@ -328,21 +336,14 @@ type
|
||||
procedure UpdateProjectDirectory;
|
||||
protected
|
||||
// special unit lists
|
||||
procedure AddToAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToComponentList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToLoadedList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
||||
procedure RemoveFromList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
||||
|
||||
procedure AddToOrRemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToOrRemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToOrRemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
procedure AddToPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
procedure RemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
procedure RemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
procedure RemoveFromComponentList(AnUnitInfo: TUnitInfo);
|
||||
procedure RemoveFromLoadedList(AnUnitInfo: TUnitInfo);
|
||||
procedure RemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
public
|
||||
constructor Create(TheProjectType: TProjectType);
|
||||
destructor Destroy; override;
|
||||
@ -438,15 +439,15 @@ type
|
||||
property CompilerOptions: TProjectCompilerOptions
|
||||
read fCompilerOptions write fCompilerOptions;
|
||||
property DefineTemplates: TProjectDefineTemplates read FDefineTemplates;
|
||||
property FirstAutoRevertLockedUnit: TUnitInfo read fFirstAutoRevertLockedUnit;
|
||||
property FirstLoadedUnit: TUnitInfo read fFirstLoadedUnit;
|
||||
property FirstPartOfProject: TUnitInfo read fFirstPartOfProject;
|
||||
property FirstAutoRevertLockedUnit: TUnitInfo read GetFirstAutoRevertLockedUnit;
|
||||
property FirstLoadedUnit: TUnitInfo read GetFirstLoadedUnit;
|
||||
property FirstPartOfProject: TUnitInfo read GetFirstPartOfProject;
|
||||
property FirstRemovedDependency: TPkgDependency
|
||||
read FFirstRemovedDependency;
|
||||
property FirstRequiredDependency: TPkgDependency
|
||||
read FFirstRequiredDependency;
|
||||
property FirstUnitWithEditorIndex: TUnitInfo read fFirstUnitWithEditorIndex;
|
||||
property FirstUnitWithForm: TUnitInfo read fFirstUnitWithComponent;
|
||||
property FirstUnitWithEditorIndex: TUnitInfo read GetFirstUnitWithEditorIndex;
|
||||
property FirstUnitWithForm: TUnitInfo read GetFirstUnitWithComponent;
|
||||
property Flags: TProjectFlags read FFlags write SetFlags;
|
||||
property IconPath: String read fIconPath write fIconPath;
|
||||
property JumpHistory: TProjectJumpHistory
|
||||
@ -781,53 +782,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.UpdateEditorIndexList;
|
||||
procedure TUnitInfo.UpdateList(ListType: TUnitInfoList; Add: boolean);
|
||||
begin
|
||||
if Project<>nil then begin
|
||||
Project.AddToOrRemoveFromEditorWithIndexList(Self);
|
||||
if Add then
|
||||
Project.AddToList(Self,ListType)
|
||||
else
|
||||
Project.RemoveFromList(Self,ListType);
|
||||
end else begin
|
||||
fNextUnitWithEditorIndex:=nil;
|
||||
fPrevUnitWithEditorIndex:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.UpdateComponentList;
|
||||
begin
|
||||
if Project<>nil then begin
|
||||
Project.AddToOrRemoveFromComponentList(Self);
|
||||
end else begin
|
||||
fNextUnitWithComponent:=nil;
|
||||
fPrevUnitWithComponent:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.UpdateLoadedList;
|
||||
begin
|
||||
if Project<>nil then begin
|
||||
Project.AddToOrRemoveFromLoadedList(Self);
|
||||
end else begin
|
||||
fNextLoadedUnit:=nil;
|
||||
fPrevLoadedUnit:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.UpdateAutoRevertLockedList;
|
||||
begin
|
||||
if Project<>nil then begin
|
||||
Project.AddToOrRemoveFromAutoRevertLockedList(Self);
|
||||
end else begin
|
||||
fNextAutoRevertLockedUnit:=nil;
|
||||
fPrevAutoRevertLockedUnit:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.UpdatePartOfProjectList;
|
||||
begin
|
||||
if Project<>nil then begin
|
||||
Project.AddToOrRemoveFromPartOfProjectList(Self);
|
||||
end else begin
|
||||
fNextPartOfProject:=nil;
|
||||
fPrevPartOfProject:=nil;
|
||||
fNext[ListType]:=nil;
|
||||
fPrev[ListType]:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1056,11 +1020,61 @@ begin
|
||||
Result:=fHasResources or (ComponentName<>'');
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetNextAutoRevertLockedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fNext[uilAutoRevertLocked];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetNextLoadedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fNext[uilLoaded];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetNextPartOfProject: TUnitInfo;
|
||||
begin
|
||||
Result:=fNext[uilPartOfProject];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetNextUnitWithComponent: TUnitInfo;
|
||||
begin
|
||||
Result:=fNext[uilWithComponent];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetNextUnitWithEditorIndex: TUnitInfo;
|
||||
begin
|
||||
Result:=fNext[uilWithEditorIndex];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetPrevAutoRevertLockedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fPrev[uilAutoRevertLocked];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetPrevLoadedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fPrev[uilLoaded];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetPrevPartOfProject: TUnitInfo;
|
||||
begin
|
||||
Result:=fPrev[uilPartOfProject];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetPrevUnitWithComponent: TUnitInfo;
|
||||
begin
|
||||
Result:=fPrev[uilWithComponent];
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetPrevUnitWithEditorIndex: TUnitInfo;
|
||||
begin
|
||||
Result:=fPrev[uilWithEditorIndex];
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetEditorIndex(const AValue: integer);
|
||||
begin
|
||||
if fEditorIndex=AValue then exit;
|
||||
fEditorIndex:=AValue;
|
||||
UpdateEditorIndexList;
|
||||
UpdateList(uilWithEditorIndex,fEditorIndex>=0);
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetFileReadOnly(const AValue: Boolean);
|
||||
@ -1075,7 +1089,7 @@ procedure TUnitInfo.SetComponent(const AValue: TComponent);
|
||||
begin
|
||||
if fComponent=AValue then exit;
|
||||
fComponent:=AValue;
|
||||
UpdateComponentList;
|
||||
UpdateList(uilWithComponent,fComponent<>nil);
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetIsPartOfProject(const AValue: boolean);
|
||||
@ -1083,7 +1097,7 @@ begin
|
||||
if fIsPartOfProject=AValue then exit;
|
||||
if Project<>nil then Project.BeginUpdate(true);
|
||||
fIsPartOfProject:=AValue;
|
||||
UpdatePartOfProjectList;
|
||||
UpdateList(uilPartOfProject,fIsPartOfProject);
|
||||
if fIsPartOfProject then UpdateUsageCount(uuIsPartOfProject,0);
|
||||
if Project<>nil then Project.EndUpdate;
|
||||
end;
|
||||
@ -1108,21 +1122,22 @@ begin
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetProject(const AValue: TProject);
|
||||
var
|
||||
ListType: TUnitInfoList;
|
||||
begin
|
||||
if FProject=AValue then exit;
|
||||
if AValue=nil then begin
|
||||
Project.RemoveFromEditorWithIndexList(Self);
|
||||
Project.RemoveFromComponentList(Self);
|
||||
Project.RemoveFromLoadedList(Self);
|
||||
Project.RemoveFromAutoRevertLockedList(Self);
|
||||
Project.RemoveFromPartOfProjectList(Self);
|
||||
if FProject<>nil then begin
|
||||
for ListType:=Low(TUnitInfoList) to High(TUnitInfoList) do
|
||||
Project.RemoveFromList(Self,ListType);
|
||||
end;
|
||||
FProject:=AValue;
|
||||
UpdateEditorIndexList;
|
||||
UpdateComponentList;
|
||||
UpdateLoadedList;
|
||||
UpdateAutoRevertLockedList;
|
||||
UpdatePartOfProjectList;
|
||||
if FProject<>nil then begin
|
||||
if EditorIndex>=0 then Project.AddToList(Self,uilWithEditorIndex);
|
||||
if Component<>nil then Project.AddToList(Self,uilWithComponent);
|
||||
if Loaded then Project.AddToList(Self,uilLoaded);
|
||||
if IsAutoRevertLocked then Project.AddToList(Self,uilAutoRevertLocked);
|
||||
if IsPartOfProject then Project.AddToList(Self,uilPartOfProject);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -1815,9 +1830,9 @@ end;
|
||||
|
||||
function TProject.UnitWithEditorIndex(Index:integer):TUnitInfo;
|
||||
begin
|
||||
Result:=fFirstUnitWithEditorIndex;
|
||||
Result:=fFirst[uilWithEditorIndex];
|
||||
while (Result<>nil) and (Result.EditorIndex<>Index) do begin
|
||||
Result:=Result.fNextUnitWithEditorIndex;
|
||||
Result:=Result.fNext[uilWithEditorIndex];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1907,9 +1922,9 @@ procedure TProject.CloseEditorIndex(EditorIndex:integer);
|
||||
var i:integer;
|
||||
AnUnitInfo, NextUnitInfo: TUnitInfo;
|
||||
begin
|
||||
AnUnitInfo:=fFirstUnitWithEditorIndex;
|
||||
AnUnitInfo:=fFirst[uilWithEditorIndex];
|
||||
while AnUnitInfo<>nil do begin
|
||||
NextUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
|
||||
NextUnitInfo:=AnUnitInfo.fNext[uilWithEditorIndex];
|
||||
if AnUnitInfo.EditorIndex=EditorIndex then
|
||||
AnUnitInfo.EditorIndex:=-1
|
||||
else if AnUnitInfo.EditorIndex>EditorIndex then
|
||||
@ -1940,10 +1955,10 @@ var i:integer;
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
// move all editor index of units:
|
||||
AnUnitInfo:=fFirstUnitWithEditorIndex;
|
||||
AnUnitInfo:=fFirst[uilWithEditorIndex];
|
||||
while AnUnitInfo<>nil do begin
|
||||
AnUnitInfo.EditorIndex:=MoveIndex(AnUnitInfo.EditorIndex);
|
||||
AnUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
|
||||
AnUnitInfo:=AnUnitInfo.fNext[uilWithEditorIndex];
|
||||
end;
|
||||
// move bookmarks
|
||||
i:=Bookmarks.Count-1;
|
||||
@ -1983,10 +1998,10 @@ var
|
||||
begin
|
||||
if OldEditorIndex=NewEditorIndex then exit;
|
||||
// move all editor index of units:
|
||||
AnUnitInfo:=fFirstUnitWithEditorIndex;
|
||||
AnUnitInfo:=fFirst[uilWithEditorIndex];
|
||||
while AnUnitInfo<>nil do begin
|
||||
AnUnitInfo.EditorIndex:=MoveIndex(AnUnitInfo.EditorIndex);
|
||||
AnUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
|
||||
AnUnitInfo:=AnUnitInfo.fNext[uilWithEditorIndex];
|
||||
end;
|
||||
// move bookmarks
|
||||
i:=Bookmarks.Count-1;
|
||||
@ -2000,45 +2015,45 @@ end;
|
||||
procedure TProject.AddToOrRemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if AnUnitInfo.EditorIndex<0 then begin
|
||||
RemoveFromEditorWithIndexList(AnUnitInfo);
|
||||
RemoveFromList(AnUnitInfo,uilWithEditorIndex);
|
||||
end else begin
|
||||
AddToEditorWithIndexList(AnUnitInfo);
|
||||
AddToList(AnUnitInfo,uilWithEditorIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if AnUnitInfo.Component=nil then begin
|
||||
RemoveFromComponentList(AnUnitInfo);
|
||||
RemoveFromList(AnUnitInfo,uilWithComponent);
|
||||
end else begin
|
||||
AddToComponentList(AnUnitInfo);
|
||||
AddToList(AnUnitInfo,uilWithComponent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if not AnUnitInfo.Loaded then begin
|
||||
RemoveFromLoadedList(AnUnitInfo);
|
||||
RemoveFromList(AnUnitInfo,uilLoaded);
|
||||
end else begin
|
||||
AddToLoadedList(AnUnitInfo);
|
||||
AddToList(AnUnitInfo,uilLoaded);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToOrRemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if not AnUnitInfo.IsAutoRevertLocked then begin
|
||||
RemoveFromAutoRevertLockedList(AnUnitInfo);
|
||||
RemoveFromList(AnUnitInfo,uilAutoRevertLocked);
|
||||
end else begin
|
||||
AddToAutoRevertLockedList(AnUnitInfo);
|
||||
AddToList(AnUnitInfo,uilAutoRevertLocked);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToOrRemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if not AnUnitInfo.IsPartOfProject then begin
|
||||
RemoveFromPartOfProjectList(AnUnitInfo);
|
||||
RemoveFromList(AnUnitInfo,uilPartOfProject);
|
||||
end else begin
|
||||
AddToPartOfProjectList(AnUnitInfo);
|
||||
AddToList(AnUnitInfo,uilPartOfProject);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2058,6 +2073,31 @@ begin
|
||||
else Result:='';
|
||||
end;
|
||||
|
||||
function TProject.GetFirstPartOfProject: TUnitInfo;
|
||||
begin
|
||||
Result:=FFirst[uilPartOfProject];
|
||||
end;
|
||||
|
||||
function TProject.GetFirstLoadedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fFirst[uilLoaded];
|
||||
end;
|
||||
|
||||
function TProject.GetFirstAutoRevertLockedUnit: TUnitInfo;
|
||||
begin
|
||||
Result:=fFirst[uilAutoRevertLocked];
|
||||
end;
|
||||
|
||||
function TProject.GetFirstUnitWithComponent: TUnitInfo;
|
||||
begin
|
||||
Result:=fFirst[uilWithComponent];
|
||||
end;
|
||||
|
||||
function TProject.GetFirstUnitWithEditorIndex: TUnitInfo;
|
||||
begin
|
||||
Result:=fFirst[uilWithEditorIndex];
|
||||
end;
|
||||
|
||||
function TProject.GetMainUnitInfo: TUnitInfo;
|
||||
begin
|
||||
if (MainUnitID>=0) and (MainUnitID<UnitCount) then
|
||||
@ -2173,14 +2213,14 @@ var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
AnUnitList:=nil;
|
||||
AnUnitInfo:=fFirstAutoRevertLockedUnit;
|
||||
AnUnitInfo:=fFirst[uilAutoRevertLocked];
|
||||
while (AnUnitInfo<>nil) do begin
|
||||
if AnUnitInfo.ChangedOnDisk(false) then begin
|
||||
if AnUnitList=nil then
|
||||
AnUnitList:=TList.Create;
|
||||
AnUnitList.Add(AnUnitInfo);
|
||||
end;
|
||||
AnUnitInfo:=AnUnitInfo.fNextAutoRevertLockedUnit;
|
||||
AnUnitInfo:=AnUnitInfo.fNext[uilAutoRevertLocked];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2358,9 +2398,9 @@ end;
|
||||
|
||||
Function TProject.UnitWithComponent(AComponent: TComponent) : TUnitInfo;
|
||||
begin
|
||||
Result:=fFirstUnitWithComponent;
|
||||
Result:=fFirst[uilWithComponent];
|
||||
while (Result<>nil) and (Result.Component<>AComponent) do
|
||||
Result:=Result.fNextUnitWithComponent;
|
||||
Result:=Result.fNext[uilWithComponent];
|
||||
end;
|
||||
|
||||
function TProject.UnitInfoWithFilename(const AFilename: string): TUnitInfo;
|
||||
@ -2420,19 +2460,19 @@ end;
|
||||
|
||||
function TProject.ProjectUnitWithFilename(const AFilename: string): TUnitInfo;
|
||||
begin
|
||||
Result:=fFirstPartOfProject;
|
||||
Result:=fFirst[uilPartOfProject];
|
||||
while Result<>nil do begin
|
||||
if CompareFileNames(AFilename,Result.Filename)=0 then exit;
|
||||
Result:=Result.NextPartOfProject;
|
||||
Result:=Result.fNext[uilPartOfProject];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProject.ProjectUnitWithUnitname(const AnUnitName: string): TUnitInfo;
|
||||
begin
|
||||
Result:=fFirstPartOfProject;
|
||||
Result:=fFirst[uilPartOfProject];
|
||||
while Result<>nil do begin
|
||||
if AnsiCompareText(AnUnitName,Result.UnitName)=0 then exit;
|
||||
Result:=Result.NextPartOfProject;
|
||||
Result:=Result.fNext[uilPartOfProject];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2442,149 +2482,34 @@ begin
|
||||
CompilerOptions.BaseDirectory:=fProjectDirectory;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
procedure TProject.AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
||||
begin
|
||||
// add to list if AnUnitInfo is not in list
|
||||
if (fFirstUnitWithEditorIndex<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNextUnitWithEditorIndex=nil)
|
||||
and (AnUnitInfo.fPrevUnitWithEditorIndex=nil) then begin
|
||||
AnUnitInfo.fNextUnitWithEditorIndex:=fFirstUnitWithEditorIndex;
|
||||
AnUnitInfo.fPrevUnitWithEditorIndex:=nil;
|
||||
fFirstUnitWithEditorIndex:=AnUnitInfo;
|
||||
if AnUnitInfo.fNextUnitWithEditorIndex<>nil then
|
||||
AnUnitInfo.fNextUnitWithEditorIndex.fPrevUnitWithEditorIndex:=AnUnitInfo;
|
||||
if (fFirst[ListType]<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNext[ListType]=nil)
|
||||
and (AnUnitInfo.fPrev[ListType]=nil) then begin
|
||||
AnUnitInfo.fNext[ListType]:=fFirst[ListType];
|
||||
AnUnitInfo.fPrev[ListType]:=nil;
|
||||
fFirst[ListType]:=AnUnitInfo;
|
||||
if AnUnitInfo.fNext[ListType]<>nil then
|
||||
AnUnitInfo.fNext[ListType].fPrev[ListType]:=AnUnitInfo;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.RemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
|
||||
procedure TProject.RemoveFromList(AnUnitInfo: TUnitInfo;
|
||||
ListType: TUnitInfoList);
|
||||
begin
|
||||
// remove from list if AnUnitInfo is in list
|
||||
if fFirstUnitWithEditorIndex=AnUnitInfo then
|
||||
fFirstUnitWithEditorIndex:=AnUnitInfo.fNextUnitWithEditorIndex;
|
||||
if AnUnitInfo.fNextUnitWithEditorIndex<>nil then
|
||||
AnUnitInfo.fNextUnitWithEditorIndex.fPrevUnitWithEditorIndex:=
|
||||
AnUnitInfo.fPrevUnitWithEditorIndex;
|
||||
if AnUnitInfo.fPrevUnitWithEditorIndex<>nil then
|
||||
AnUnitInfo.fPrevUnitWithEditorIndex.fNextUnitWithEditorIndex:=
|
||||
AnUnitInfo.fNextUnitWithEditorIndex;
|
||||
AnUnitInfo.fNextUnitWithEditorIndex:=nil;
|
||||
AnUnitInfo.fPrevUnitWithEditorIndex:=nil;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToComponentList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// add to list if AnUnitInfo is not in list
|
||||
if (fFirstUnitWithComponent<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNextUnitWithComponent=nil)
|
||||
and (AnUnitInfo.fPrevUnitWithComponent=nil) then begin
|
||||
AnUnitInfo.fNextUnitWithComponent:=fFirstUnitWithComponent;
|
||||
AnUnitInfo.fPrevUnitWithComponent:=nil;
|
||||
fFirstUnitWithComponent:=AnUnitInfo;
|
||||
if AnUnitInfo.fNextUnitWithComponent<>nil then
|
||||
AnUnitInfo.fNextUnitWithComponent.fPrevUnitWithComponent:=AnUnitInfo;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.RemoveFromComponentList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// remove from list if AnUnitInfo is in list
|
||||
if fFirstUnitWithComponent=AnUnitInfo then
|
||||
fFirstUnitWithComponent:=AnUnitInfo.fNextUnitWithComponent;
|
||||
if AnUnitInfo.fNextUnitWithComponent<>nil then
|
||||
AnUnitInfo.fNextUnitWithComponent.fPrevUnitWithComponent:=
|
||||
AnUnitInfo.fPrevUnitWithComponent;
|
||||
if AnUnitInfo.fPrevUnitWithComponent<>nil then
|
||||
AnUnitInfo.fPrevUnitWithComponent.fNextUnitWithComponent:=
|
||||
AnUnitInfo.fNextUnitWithComponent;
|
||||
AnUnitInfo.fNextUnitWithComponent:=nil;
|
||||
AnUnitInfo.fPrevUnitWithComponent:=nil;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToLoadedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// add to list if AnUnitInfo is not in list
|
||||
if (fFirstLoadedUnit<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNextLoadedUnit=nil)
|
||||
and (AnUnitInfo.fPrevLoadedUnit=nil) then begin
|
||||
AnUnitInfo.fNextLoadedUnit:=fFirstLoadedUnit;
|
||||
AnUnitInfo.fPrevLoadedUnit:=nil;
|
||||
fFirstLoadedUnit:=AnUnitInfo;
|
||||
if AnUnitInfo.fNextLoadedUnit<>nil then
|
||||
AnUnitInfo.fNextLoadedUnit.fPrevLoadedUnit:=AnUnitInfo;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.RemoveFromLoadedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// remove from list if AnUnitInfo is in list
|
||||
if fFirstLoadedUnit=AnUnitInfo then
|
||||
fFirstLoadedUnit:=AnUnitInfo.fNextLoadedUnit;
|
||||
if AnUnitInfo.fNextLoadedUnit<>nil then
|
||||
AnUnitInfo.fNextLoadedUnit.fPrevLoadedUnit:=
|
||||
AnUnitInfo.fPrevLoadedUnit;
|
||||
if AnUnitInfo.fPrevLoadedUnit<>nil then
|
||||
AnUnitInfo.fPrevLoadedUnit.fNextLoadedUnit:=
|
||||
AnUnitInfo.fNextLoadedUnit;
|
||||
AnUnitInfo.fNextLoadedUnit:=nil;
|
||||
AnUnitInfo.fPrevLoadedUnit:=nil;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// add to list if AnUnitInfo is not in list
|
||||
if (fFirstAutoRevertLockedUnit<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNextAutoRevertLockedUnit=nil)
|
||||
and (AnUnitInfo.fPrevAutoRevertLockedUnit=nil) then begin
|
||||
AnUnitInfo.fNextAutoRevertLockedUnit:=fFirstAutoRevertLockedUnit;
|
||||
AnUnitInfo.fPrevAutoRevertLockedUnit:=nil;
|
||||
fFirstAutoRevertLockedUnit:=AnUnitInfo;
|
||||
if AnUnitInfo.fNextAutoRevertLockedUnit<>nil then
|
||||
AnUnitInfo.fNextAutoRevertLockedUnit.fPrevAutoRevertLockedUnit:=AnUnitInfo;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.RemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// remove from list if AnUnitInfo is in list
|
||||
if fFirstAutoRevertLockedUnit=AnUnitInfo then
|
||||
fFirstAutoRevertLockedUnit:=AnUnitInfo.fNextAutoRevertLockedUnit;
|
||||
if AnUnitInfo.fNextAutoRevertLockedUnit<>nil then
|
||||
AnUnitInfo.fNextAutoRevertLockedUnit.fPrevAutoRevertLockedUnit:=
|
||||
AnUnitInfo.fPrevAutoRevertLockedUnit;
|
||||
if AnUnitInfo.fPrevAutoRevertLockedUnit<>nil then
|
||||
AnUnitInfo.fPrevAutoRevertLockedUnit.fNextAutoRevertLockedUnit:=
|
||||
AnUnitInfo.fNextAutoRevertLockedUnit;
|
||||
AnUnitInfo.fNextAutoRevertLockedUnit:=nil;
|
||||
AnUnitInfo.fPrevAutoRevertLockedUnit:=nil;
|
||||
end;
|
||||
|
||||
procedure TProject.AddToPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// add to list if AnUnitInfo is not in list
|
||||
if (fFirstPartOfProject<>AnUnitInfo)
|
||||
and (AnUnitInfo.fNextPartOfProject=nil)
|
||||
and (AnUnitInfo.fPrevPartOfProject=nil) then begin
|
||||
AnUnitInfo.fNextPartOfProject:=fFirstPartOfProject;
|
||||
AnUnitInfo.fPrevPartOfProject:=nil;
|
||||
fFirstPartOfProject:=AnUnitInfo;
|
||||
if AnUnitInfo.fNextPartOfProject<>nil then
|
||||
AnUnitInfo.fNextPartOfProject.fPrevPartOfProject:=AnUnitInfo;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProject.RemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo);
|
||||
begin
|
||||
// remove from list if AnUnitInfo is in list
|
||||
if fFirstPartOfProject=AnUnitInfo then
|
||||
fFirstPartOfProject:=AnUnitInfo.fNextPartOfProject;
|
||||
if AnUnitInfo.fNextPartOfProject<>nil then
|
||||
AnUnitInfo.fNextPartOfProject.fPrevPartOfProject:=
|
||||
AnUnitInfo.fPrevPartOfProject;
|
||||
if AnUnitInfo.fPrevPartOfProject<>nil then
|
||||
AnUnitInfo.fPrevPartOfProject.fNextPartOfProject:=
|
||||
AnUnitInfo.fNextPartOfProject;
|
||||
AnUnitInfo.fNextPartOfProject:=nil;
|
||||
AnUnitInfo.fPrevPartOfProject:=nil;
|
||||
if fFirst[ListType]=AnUnitInfo then
|
||||
fFirst[ListType]:=AnUnitInfo.fNext[ListType];
|
||||
if AnUnitInfo.fNext[ListType]<>nil then
|
||||
AnUnitInfo.fNext[ListType].fPrev[ListType]:=
|
||||
AnUnitInfo.fPrev[ListType];
|
||||
if AnUnitInfo.fPrev[ListType]<>nil then
|
||||
AnUnitInfo.fPrev[ListType].fNext[ListType]:=
|
||||
AnUnitInfo.fNext[ListType];
|
||||
AnUnitInfo.fNext[ListType]:=nil;
|
||||
AnUnitInfo.fPrev[ListType]:=nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -2713,6 +2638,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.125 2003/06/01 11:23:01 mattias
|
||||
splittet designer form and lookup root
|
||||
|
||||
Revision 1.124 2003/05/31 10:07:33 mattias
|
||||
changed projects forms into components
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user