mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 21:19:24 +02:00
IDE: indentiation
git-svn-id: trunk@45217 -
This commit is contained in:
parent
8844f15f3a
commit
5656db6508
@ -63,6 +63,12 @@ type
|
|||||||
procedure UpdateComponentNodesValues; virtual;
|
procedure UpdateComponentNodesValues; virtual;
|
||||||
function CreateNodeCaption(APersistent: TPersistent; DefaultName: string = ''): string; virtual;
|
function CreateNodeCaption(APersistent: TPersistent; DefaultName: string = ''): string; virtual;
|
||||||
public
|
public
|
||||||
|
ImgIndexForm: Integer;
|
||||||
|
ImgIndexComponent: Integer;
|
||||||
|
ImgIndexControl: Integer;
|
||||||
|
ImgIndexBox: Integer;
|
||||||
|
ImgIndexCollection: Integer;
|
||||||
|
ImgIndexItem: Integer;
|
||||||
property Selection: TPersistentSelectionList read GetSelection
|
property Selection: TPersistentSelectionList read GetSelection
|
||||||
write SetSelection;
|
write SetSelection;
|
||||||
property PropertyEditorHook: TPropertyEditorHook
|
property PropertyEditorHook: TPropertyEditorHook
|
||||||
@ -535,26 +541,27 @@ function TComponentTreeView.GetImageFor(APersistent: TPersistent): integer;
|
|||||||
begin
|
begin
|
||||||
if Assigned(APersistent) then
|
if Assigned(APersistent) then
|
||||||
begin
|
begin
|
||||||
if (APersistent is TControl) and (csAcceptsControls in TControl(APersistent).ControlStyle) then
|
if (APersistent is TControl)
|
||||||
Result := 3
|
and (csAcceptsControls in TControl(APersistent).ControlStyle) then
|
||||||
|
Result := ImgIndexBox
|
||||||
else
|
else
|
||||||
if (APersistent is TControl) then
|
if (APersistent is TControl) then
|
||||||
Result := 2
|
Result := ImgIndexControl
|
||||||
else
|
else
|
||||||
if (APersistent is TComponent) then
|
if (APersistent is TComponent) then
|
||||||
Result := 1
|
Result := ImgIndexComponent
|
||||||
else
|
else
|
||||||
if (APersistent is TCollection) then
|
if (APersistent is TCollection) then
|
||||||
Result := 4
|
Result := ImgIndexCollection
|
||||||
else
|
else
|
||||||
if (APersistent is TCollectionItem) then
|
if (APersistent is TCollectionItem) then
|
||||||
Result := 5;
|
Result := ImgIndexItem;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := -1;
|
Result := -1;
|
||||||
|
|
||||||
//finally, ask the designer such as TDesignerMediator to override it, if any
|
// finally, ask the designer such as TDesignerMediator to override it, if any
|
||||||
if assigned(OnComponentGetImageIndex) then
|
if Assigned(OnComponentGetImageIndex) then
|
||||||
OnComponentGetImageIndex(APersistent, Result);
|
OnComponentGetImageIndex(APersistent, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -583,17 +590,17 @@ begin
|
|||||||
Bitmap := TPortableNetworkGraphic.Create;
|
Bitmap := TPortableNetworkGraphic.Create;
|
||||||
try
|
try
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_form');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_form');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexForm:=FImageList.Add(Bitmap, nil);
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_comp');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_comp');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexComponent:=FImageList.Add(Bitmap, nil);
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_control');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_control');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexControl:=FImageList.Add(Bitmap, nil);
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_box');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_box');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexBox:=FImageList.Add(Bitmap, nil);
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_collection');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_collection');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexCollection:=FImageList.Add(Bitmap, nil);
|
||||||
Bitmap.LoadFromResourceName(HInstance, 'oi_item');
|
Bitmap.LoadFromResourceName(HInstance, 'oi_item');
|
||||||
FImageList.Add(Bitmap, nil);
|
ImgIndexItem:=FImageList.Add(Bitmap, nil);
|
||||||
finally
|
finally
|
||||||
Bitmap.Free;
|
Bitmap.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -78,7 +78,7 @@ type
|
|||||||
procedure MouseDown({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
procedure MouseDown({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||||
procedure MouseMove({%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
procedure MouseMove({%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||||
procedure MouseUp({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
procedure MouseUp({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||||
procedure OiNodeGetImageIndex(APersistent: TPersistent; var AIndex: integer); virtual;
|
procedure GetObjInspNodeImageIndex({%H-}APersistent: TPersistent; var {%H-}AIndex: integer); virtual;
|
||||||
|
|
||||||
property LCLForm: TForm read FLCLForm write SetLCLForm;
|
property LCLForm: TForm read FLCLForm write SetLCLForm;
|
||||||
property Designer: TComponentEditorDesigner read FDesigner write SetDesigner;
|
property Designer: TComponentEditorDesigner read FDesigner write SetDesigner;
|
||||||
@ -461,7 +461,7 @@ begin
|
|||||||
if ComponentIsIcon(Child) then
|
if ComponentIsIcon(Child) then
|
||||||
OffsetRect(ChildBounds,ScrollOffset.X,
|
OffsetRect(ChildBounds,ScrollOffset.X,
|
||||||
ScrollOffset.Y)
|
ScrollOffset.Y)
|
||||||
else///x2nie
|
else
|
||||||
OffsetRect(ChildBounds,ClientArea.Left+ScrollOffset.X,
|
OffsetRect(ChildBounds,ClientArea.Left+ScrollOffset.X,
|
||||||
ClientArea.Top+ScrollOffset.Y);
|
ClientArea.Top+ScrollOffset.Y);
|
||||||
//DebugLn(['TDesignerMediator.ComponentAtPos ChildBounds=',dbgs(ChildBounds),' p=',dbgs(p)]);
|
//DebugLn(['TDesignerMediator.ComponentAtPos ChildBounds=',dbgs(ChildBounds),' p=',dbgs(p)]);
|
||||||
@ -531,7 +531,7 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesignerMediator.OiNodeGetImageIndex(APersistent: TPersistent;
|
procedure TDesignerMediator.GetObjInspNodeImageIndex(APersistent: TPersistent;
|
||||||
var AIndex: integer);
|
var AIndex: integer);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
@ -616,6 +616,7 @@ type
|
|||||||
StatusBar: TStatusBar;
|
StatusBar: TStatusBar;
|
||||||
procedure AvailComboBoxCloseUp(Sender: TObject);
|
procedure AvailComboBoxCloseUp(Sender: TObject);
|
||||||
procedure ComponentTreeDblClick(Sender: TObject);
|
procedure ComponentTreeDblClick(Sender: TObject);
|
||||||
|
procedure ComponentTreeGetNodeImageIndex(APersistent: TPersistent; var AIndex: integer);
|
||||||
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
procedure ComponentTreeSelectionChanged(Sender: TObject);
|
procedure ComponentTreeSelectionChanged(Sender: TObject);
|
||||||
procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
@ -637,7 +638,6 @@ type
|
|||||||
procedure OnShowStatusBarPopupMenuItemClick(Sender: TObject);
|
procedure OnShowStatusBarPopupMenuItemClick(Sender: TObject);
|
||||||
procedure OnShowOptionsPopupMenuItemClick(Sender: TObject);
|
procedure OnShowOptionsPopupMenuItemClick(Sender: TObject);
|
||||||
procedure OnMainPopupMenuPopup(Sender: TObject);
|
procedure OnMainPopupMenuPopup(Sender: TObject);
|
||||||
procedure OnVTNodeGetImageIndex(APersistent: TPersistent; var AIndex: integer);
|
|
||||||
procedure RestrictedPageShow(Sender: TObject);
|
procedure RestrictedPageShow(Sender: TObject);
|
||||||
procedure WidgetSetRestrictedPaint(Sender: TObject);
|
procedure WidgetSetRestrictedPaint(Sender: TObject);
|
||||||
procedure ComponentRestrictedPaint(Sender: TObject);
|
procedure ComponentRestrictedPaint(Sender: TObject);
|
||||||
@ -4094,7 +4094,7 @@ begin
|
|||||||
OnDblClick := @ComponentTreeDblClick;
|
OnDblClick := @ComponentTreeDblClick;
|
||||||
OnKeyDown := @ComponentTreeKeyDown;
|
OnKeyDown := @ComponentTreeKeyDown;
|
||||||
OnSelectionChanged := @ComponentTreeSelectionChanged;
|
OnSelectionChanged := @ComponentTreeSelectionChanged;
|
||||||
OnComponentGetImageIndex := @OnVTNodeGetImageIndex;
|
OnComponentGetImageIndex := @ComponentTreeGetNodeImageIndex;
|
||||||
OnModified := @DoModified;
|
OnModified := @DoModified;
|
||||||
Scrollbars := ssAutoBoth;
|
Scrollbars := ssAutoBoth;
|
||||||
PopupMenu := MainPopupMenu;
|
PopupMenu := MainPopupMenu;
|
||||||
@ -5514,7 +5514,7 @@ begin
|
|||||||
FavoriteGrid.Favorites:=FFavorites;
|
FavoriteGrid.Favorites:=FFavorites;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.OnVTNodeGetImageIndex(
|
procedure TObjectInspectorDlg.ComponentTreeGetNodeImageIndex(
|
||||||
APersistent: TPersistent; var AIndex: integer);
|
APersistent: TPersistent; var AIndex: integer);
|
||||||
begin
|
begin
|
||||||
//ask TMediator
|
//ask TMediator
|
||||||
|
@ -656,11 +656,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
||||||
begin
|
begin
|
||||||
Owner.Mediator.SetBounds(TComponent(FPersistent),Rect( ALeft, ATop, ALeft+AWidth, ATop+AHeight));//x2nie
|
Owner.Mediator.SetBounds(TComponent(FPersistent),
|
||||||
|
Bounds(ALeft, ATop, AWidth, AHeight));
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
begin
|
|
||||||
|
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),OldBounds);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),OldBounds);
|
||||||
ParentOffset:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
ParentOffset:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||||
dec(ParentOffset.X,OldBounds.Left);
|
dec(ParentOffset.X,OldBounds.Left);
|
||||||
@ -687,11 +686,10 @@ begin
|
|||||||
if Owner.Mediator<>nil then begin
|
if Owner.Mediator<>nil then begin
|
||||||
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
||||||
begin
|
begin
|
||||||
GetComponentBounds(TComponent(FPersistent),ALeft, ATop, AWidth, AHeight);//x2nie
|
GetComponentBounds(TComponent(FPersistent),ALeft, ATop, AWidth, AHeight);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|
||||||
ALeftTop:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
ALeftTop:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),CurBounds);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),CurBounds);
|
||||||
ALeft:=ALeftTop.X;
|
ALeft:=ALeftTop.X;
|
||||||
@ -735,9 +733,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
GetComponentBounds(TComponent(FPersistent),
|
GetComponentBounds(TComponent(FPersistent),
|
||||||
FOldLeft,FOldTop,FOldWidth,FOldHeight);
|
FOldLeft,FOldTop,FOldWidth,FOldHeight);
|
||||||
end
|
end else begin
|
||||||
else
|
|
||||||
begin
|
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||||
FOldLeft:=r.Left;
|
FOldLeft:=r.Left;
|
||||||
FOldTop:=r.Top;
|
FOldTop:=r.Top;
|
||||||
@ -1641,9 +1637,7 @@ begin
|
|||||||
if not PersistentAlignable(AComponent) then continue;
|
if not PersistentAlignable(AComponent) then continue;
|
||||||
if IsSelected(AComponent) then continue;
|
if IsSelected(AComponent) then continue;
|
||||||
if FMediator <> nil then
|
if FMediator <> nil then
|
||||||
begin
|
CurLeft := FMediator.GetComponentOriginOnForm(AComponent).X
|
||||||
CurLeft := FMediator.GetComponentOriginOnForm(AComponent).X;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
CurLeft:=GetParentFormRelativeTopLeft(AComponent).X;
|
CurLeft:=GetParentFormRelativeTopLeft(AComponent).X;
|
||||||
CurDist:=Abs(CurLeft-NearestInt.OldValue);
|
CurDist:=Abs(CurLeft-NearestInt.OldValue);
|
||||||
@ -1691,9 +1685,7 @@ begin
|
|||||||
if not PersistentAlignable(AComponent) then continue;
|
if not PersistentAlignable(AComponent) then continue;
|
||||||
if IsSelected(AComponent) then continue;
|
if IsSelected(AComponent) then continue;
|
||||||
if FMediator <> nil then
|
if FMediator <> nil then
|
||||||
begin
|
CurTop := FMediator.GetComponentOriginOnForm(AComponent).Y
|
||||||
CurTop := FMediator.GetComponentOriginOnForm(AComponent).Y;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
CurTop:=GetParentFormRelativeTopLeft(AComponent).Y;
|
CurTop:=GetParentFormRelativeTopLeft(AComponent).Y;
|
||||||
CurDist:=Abs(CurTop-NearestInt.OldValue);
|
CurDist:=Abs(CurTop-NearestInt.OldValue);
|
||||||
|
@ -3611,9 +3611,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TDesigner.GetParentFormRelativeClientOrigin(AComponent: TComponent): TPoint;
|
function TDesigner.GetParentFormRelativeClientOrigin(AComponent: TComponent): TPoint;
|
||||||
var
|
|
||||||
CurClientArea: TRect;
|
|
||||||
ScrollOffset: TPoint;
|
|
||||||
begin
|
begin
|
||||||
if Mediator<>nil then begin
|
if Mediator<>nil then begin
|
||||||
Result:=Mediator.GetComponentOriginOnForm(AComponent);
|
Result:=Mediator.GetComponentOriginOnForm(AComponent);
|
||||||
|
@ -65,7 +65,7 @@ type
|
|||||||
procedure InvalidateRect(Sender: TObject; ARect: TRect; Erase: boolean);
|
procedure InvalidateRect(Sender: TObject; ARect: TRect; Erase: boolean);
|
||||||
property MyForm: TMyForm read FMyForm;
|
property MyForm: TMyForm read FMyForm;
|
||||||
public
|
public
|
||||||
procedure OiNodeGetImageIndex(APersistent: TPersistent; var AIndex: integer); override;
|
procedure GetObjInspNodeImageIndex(APersistent: TPersistent; var AIndex: integer); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFileDescPascalUnitWithMyForm }
|
{ TFileDescPascalUnitWithMyForm }
|
||||||
@ -140,18 +140,18 @@ begin
|
|||||||
LCLIntf.InvalidateRect(LCLForm.Handle,@ARect,Erase);
|
LCLIntf.InvalidateRect(LCLForm.Handle,@ARect,Erase);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMyWidgetMediator.OiNodeGetImageIndex(APersistent: TPersistent;
|
procedure TMyWidgetMediator.GetObjInspNodeImageIndex(APersistent: TPersistent;
|
||||||
var AIndex: integer);
|
var AIndex: integer);
|
||||||
begin
|
begin
|
||||||
if Assigned(APersistent) then
|
if Assigned(APersistent) then
|
||||||
begin
|
begin
|
||||||
if (APersistent is TMyWidget) and (TMyWidget(APersistent).AcceptChildrenAtDesignTime) then
|
if (APersistent is TMyWidget) and (TMyWidget(APersistent).AcceptChildrenAtDesignTime) then
|
||||||
AIndex := 3
|
AIndex := FormEditingHook.GetCurrentObjectInspector.ComponentTree.ImgIndexBox
|
||||||
else
|
else
|
||||||
if (APersistent is TMyWidget) then
|
if (APersistent is TMyWidget) then
|
||||||
AIndex := 2
|
AIndex := FormEditingHook.GetCurrentObjectInspector.ComponentTree.ImgIndexControl
|
||||||
else
|
else
|
||||||
inherited OiNodeGetImageIndex(APersistent, AIndex);
|
inherited;
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2423,7 +2423,7 @@ begin
|
|||||||
|
|
||||||
//ask TMediator
|
//ask TMediator
|
||||||
if DesignerForm is TNonControlDesignerForm then
|
if DesignerForm is TNonControlDesignerForm then
|
||||||
TNonControlDesignerForm(DesignerForm).Mediator.OiNodeGetImageIndex(APersistent, AImageIndex);
|
TNonControlDesignerForm(DesignerForm).Mediator.GetObjInspNodeImageIndex(APersistent, AImageIndex);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user