mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 14:57:57 +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;
|
||||
function CreateNodeCaption(APersistent: TPersistent; DefaultName: string = ''): string; virtual;
|
||||
public
|
||||
ImgIndexForm: Integer;
|
||||
ImgIndexComponent: Integer;
|
||||
ImgIndexControl: Integer;
|
||||
ImgIndexBox: Integer;
|
||||
ImgIndexCollection: Integer;
|
||||
ImgIndexItem: Integer;
|
||||
property Selection: TPersistentSelectionList read GetSelection
|
||||
write SetSelection;
|
||||
property PropertyEditorHook: TPropertyEditorHook
|
||||
@ -535,27 +541,28 @@ function TComponentTreeView.GetImageFor(APersistent: TPersistent): integer;
|
||||
begin
|
||||
if Assigned(APersistent) then
|
||||
begin
|
||||
if (APersistent is TControl) and (csAcceptsControls in TControl(APersistent).ControlStyle) then
|
||||
Result := 3
|
||||
if (APersistent is TControl)
|
||||
and (csAcceptsControls in TControl(APersistent).ControlStyle) then
|
||||
Result := ImgIndexBox
|
||||
else
|
||||
if (APersistent is TControl) then
|
||||
Result := 2
|
||||
Result := ImgIndexControl
|
||||
else
|
||||
if (APersistent is TComponent) then
|
||||
Result := 1
|
||||
Result := ImgIndexComponent
|
||||
else
|
||||
if (APersistent is TCollection) then
|
||||
Result := 4
|
||||
Result := ImgIndexCollection
|
||||
else
|
||||
if (APersistent is TCollectionItem) then
|
||||
Result := 5;
|
||||
Result := ImgIndexItem;
|
||||
end
|
||||
else
|
||||
Result := -1;
|
||||
|
||||
//finally, ask the designer such as TDesignerMediator to override it, if any
|
||||
if assigned(OnComponentGetImageIndex) then
|
||||
OnComponentGetImageIndex(APersistent, Result);
|
||||
// finally, ask the designer such as TDesignerMediator to override it, if any
|
||||
if Assigned(OnComponentGetImageIndex) then
|
||||
OnComponentGetImageIndex(APersistent, Result);
|
||||
end;
|
||||
|
||||
procedure TComponentTreeView.SetPropertyEditorHook(
|
||||
@ -583,17 +590,17 @@ begin
|
||||
Bitmap := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_form');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexForm:=FImageList.Add(Bitmap, nil);
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_comp');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexComponent:=FImageList.Add(Bitmap, nil);
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_control');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexControl:=FImageList.Add(Bitmap, nil);
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_box');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexBox:=FImageList.Add(Bitmap, nil);
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_collection');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexCollection:=FImageList.Add(Bitmap, nil);
|
||||
Bitmap.LoadFromResourceName(HInstance, 'oi_item');
|
||||
FImageList.Add(Bitmap, nil);
|
||||
ImgIndexItem:=FImageList.Add(Bitmap, nil);
|
||||
finally
|
||||
Bitmap.Free;
|
||||
end;
|
||||
|
@ -78,7 +78,7 @@ type
|
||||
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 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 Designer: TComponentEditorDesigner read FDesigner write SetDesigner;
|
||||
@ -461,9 +461,9 @@ begin
|
||||
if ComponentIsIcon(Child) then
|
||||
OffsetRect(ChildBounds,ScrollOffset.X,
|
||||
ScrollOffset.Y)
|
||||
else///x2nie
|
||||
OffsetRect(ChildBounds,ClientArea.Left+ScrollOffset.X,
|
||||
ClientArea.Top+ScrollOffset.Y);
|
||||
else
|
||||
OffsetRect(ChildBounds,ClientArea.Left+ScrollOffset.X,
|
||||
ClientArea.Top+ScrollOffset.Y);
|
||||
//DebugLn(['TDesignerMediator.ComponentAtPos ChildBounds=',dbgs(ChildBounds),' p=',dbgs(p)]);
|
||||
if PtInRect(ChildBounds,p) then begin
|
||||
Found:=true;
|
||||
@ -531,7 +531,7 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TDesignerMediator.OiNodeGetImageIndex(APersistent: TPersistent;
|
||||
procedure TDesignerMediator.GetObjInspNodeImageIndex(APersistent: TPersistent;
|
||||
var AIndex: integer);
|
||||
begin
|
||||
|
||||
|
@ -616,6 +616,7 @@ type
|
||||
StatusBar: TStatusBar;
|
||||
procedure AvailComboBoxCloseUp(Sender: TObject);
|
||||
procedure ComponentTreeDblClick(Sender: TObject);
|
||||
procedure ComponentTreeGetNodeImageIndex(APersistent: TPersistent; var AIndex: integer);
|
||||
procedure ComponentTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ComponentTreeSelectionChanged(Sender: TObject);
|
||||
procedure OnGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
@ -637,7 +638,6 @@ type
|
||||
procedure OnShowStatusBarPopupMenuItemClick(Sender: TObject);
|
||||
procedure OnShowOptionsPopupMenuItemClick(Sender: TObject);
|
||||
procedure OnMainPopupMenuPopup(Sender: TObject);
|
||||
procedure OnVTNodeGetImageIndex(APersistent: TPersistent; var AIndex: integer);
|
||||
procedure RestrictedPageShow(Sender: TObject);
|
||||
procedure WidgetSetRestrictedPaint(Sender: TObject);
|
||||
procedure ComponentRestrictedPaint(Sender: TObject);
|
||||
@ -4094,7 +4094,7 @@ begin
|
||||
OnDblClick := @ComponentTreeDblClick;
|
||||
OnKeyDown := @ComponentTreeKeyDown;
|
||||
OnSelectionChanged := @ComponentTreeSelectionChanged;
|
||||
OnComponentGetImageIndex := @OnVTNodeGetImageIndex;
|
||||
OnComponentGetImageIndex := @ComponentTreeGetNodeImageIndex;
|
||||
OnModified := @DoModified;
|
||||
Scrollbars := ssAutoBoth;
|
||||
PopupMenu := MainPopupMenu;
|
||||
@ -5514,7 +5514,7 @@ begin
|
||||
FavoriteGrid.Favorites:=FFavorites;
|
||||
end;
|
||||
|
||||
procedure TObjectInspectorDlg.OnVTNodeGetImageIndex(
|
||||
procedure TObjectInspectorDlg.ComponentTreeGetNodeImageIndex(
|
||||
APersistent: TPersistent; var AIndex: integer);
|
||||
begin
|
||||
//ask TMediator
|
||||
|
@ -656,17 +656,16 @@ begin
|
||||
begin
|
||||
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
||||
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
|
||||
else
|
||||
begin
|
||||
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),OldBounds);
|
||||
ParentOffset:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||
dec(ParentOffset.X,OldBounds.Left);
|
||||
dec(ParentOffset.Y,OldBounds.Top);
|
||||
Owner.Mediator.SetBounds(TComponent(FPersistent),
|
||||
Bounds(ALeft-ParentOffset.X,ATop-ParentOffset.Y,AWidth,AHeight));
|
||||
else begin
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),OldBounds);
|
||||
ParentOffset:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||
dec(ParentOffset.X,OldBounds.Left);
|
||||
dec(ParentOffset.Y,OldBounds.Top);
|
||||
Owner.Mediator.SetBounds(TComponent(FPersistent),
|
||||
Bounds(ALeft-ParentOffset.X,ATop-ParentOffset.Y,AWidth,AHeight));
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -687,17 +686,16 @@ begin
|
||||
if Owner.Mediator<>nil then begin
|
||||
if Owner.Mediator.ComponentIsIcon(TComponent(FPersistent)) then
|
||||
begin
|
||||
GetComponentBounds(TComponent(FPersistent),ALeft, ATop, AWidth, AHeight);//x2nie
|
||||
GetComponentBounds(TComponent(FPersistent),ALeft, ATop, AWidth, AHeight);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
||||
ALeftTop:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),CurBounds);
|
||||
ALeft:=ALeftTop.X;
|
||||
ATop:=ALeftTop.Y;
|
||||
AWidth:=CurBounds.Right-CurBounds.Left;
|
||||
AHeight:=CurBounds.Bottom-CurBounds.Top;
|
||||
ALeftTop:=Owner.Mediator.GetComponentOriginOnForm(TComponent(FPersistent));
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),CurBounds);
|
||||
ALeft:=ALeftTop.X;
|
||||
ATop:=ALeftTop.Y;
|
||||
AWidth:=CurBounds.Right-CurBounds.Left;
|
||||
AHeight:=CurBounds.Bottom-CurBounds.Top;
|
||||
end;
|
||||
end else begin
|
||||
ALeftTop := GetParentFormRelativeTopLeft(TComponent(FPersistent));
|
||||
@ -735,14 +733,12 @@ begin
|
||||
begin
|
||||
GetComponentBounds(TComponent(FPersistent),
|
||||
FOldLeft,FOldTop,FOldWidth,FOldHeight);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||
FOldLeft:=r.Left;
|
||||
FOldTop:=r.Top;
|
||||
FOldWidth:=r.Right-r.Left;
|
||||
FOldHeight:=r.Bottom-r.Top;
|
||||
end else begin
|
||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||
FOldLeft:=r.Left;
|
||||
FOldTop:=r.Top;
|
||||
FOldWidth:=r.Right-r.Left;
|
||||
FOldHeight:=r.Bottom-r.Top;
|
||||
end;
|
||||
end else begin
|
||||
GetComponentBounds(TComponent(FPersistent),
|
||||
@ -1641,11 +1637,9 @@ begin
|
||||
if not PersistentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
if FMediator <> nil then
|
||||
begin
|
||||
CurLeft := FMediator.GetComponentOriginOnForm(AComponent).X;
|
||||
end
|
||||
CurLeft := FMediator.GetComponentOriginOnForm(AComponent).X
|
||||
else
|
||||
CurLeft:=GetParentFormRelativeTopLeft(AComponent).X;
|
||||
CurLeft:=GetParentFormRelativeTopLeft(AComponent).X;
|
||||
CurDist:=Abs(CurLeft-NearestInt.OldValue);
|
||||
if CurDist>MaxDist then continue; // skip components far away
|
||||
ImproveNearestInt(NearestInt,CurLeft);
|
||||
@ -1671,8 +1665,8 @@ begin
|
||||
CurRight := FMediator.GetComponentOriginOnForm(AComponent).X+ R.Right;
|
||||
end
|
||||
else
|
||||
CurRight:=GetParentFormRelativeTopLeft(AComponent).X
|
||||
+GetComponentWidth(AComponent);
|
||||
CurRight:=GetParentFormRelativeTopLeft(AComponent).X
|
||||
+GetComponentWidth(AComponent);
|
||||
CurDist:=Abs(CurRight-NearestInt.OldValue);
|
||||
if CurDist>MaxDist then continue; // skip components far away
|
||||
ImproveNearestInt(NearestInt,CurRight);
|
||||
@ -1691,11 +1685,9 @@ begin
|
||||
if not PersistentAlignable(AComponent) then continue;
|
||||
if IsSelected(AComponent) then continue;
|
||||
if FMediator <> nil then
|
||||
begin
|
||||
CurTop := FMediator.GetComponentOriginOnForm(AComponent).Y;
|
||||
end
|
||||
CurTop := FMediator.GetComponentOriginOnForm(AComponent).Y
|
||||
else
|
||||
CurTop:=GetParentFormRelativeTopLeft(AComponent).Y;
|
||||
CurTop:=GetParentFormRelativeTopLeft(AComponent).Y;
|
||||
CurDist:=Abs(CurTop-NearestInt.OldValue);
|
||||
if CurDist>MaxDist then continue; // skip components far away
|
||||
ImproveNearestInt(NearestInt,CurTop);
|
||||
@ -1721,8 +1713,8 @@ begin
|
||||
CurBottom := FMediator.GetComponentOriginOnForm(AComponent).Y+ R.Bottom;
|
||||
end
|
||||
else
|
||||
CurBottom:=GetParentFormRelativeTopLeft(AComponent).Y
|
||||
+GetComponentHeight(AComponent);
|
||||
CurBottom:=GetParentFormRelativeTopLeft(AComponent).Y
|
||||
+GetComponentHeight(AComponent);
|
||||
CurDist:=Abs(CurBottom-NearestInt.OldValue);
|
||||
if CurDist>MaxDist then continue; // skip components far away
|
||||
ImproveNearestInt(NearestInt,CurBottom);
|
||||
|
@ -3611,9 +3611,6 @@ begin
|
||||
end;
|
||||
|
||||
function TDesigner.GetParentFormRelativeClientOrigin(AComponent: TComponent): TPoint;
|
||||
var
|
||||
CurClientArea: TRect;
|
||||
ScrollOffset: TPoint;
|
||||
begin
|
||||
if Mediator<>nil then begin
|
||||
Result:=Mediator.GetComponentOriginOnForm(AComponent);
|
||||
|
@ -132,14 +132,14 @@ begin
|
||||
with Canvas do begin
|
||||
if LookupRoot is TDataModule then
|
||||
begin
|
||||
Brush.Color:=clWhite;
|
||||
ARect:=Rect(FrameWidth,FrameWidth,
|
||||
Self.ClientWidth-FrameWidth,
|
||||
Self.ClientHeight-FrameWidth);
|
||||
FillRect(ARect);
|
||||
ARect:=Rect(0,0,Self.ClientWidth+1,Self.ClientHeight+1);
|
||||
Pen.Color:=clBlack;
|
||||
Frame3d(ARect, FrameWidth, bvLowered);
|
||||
Brush.Color:=clWhite;
|
||||
ARect:=Rect(FrameWidth,FrameWidth,
|
||||
Self.ClientWidth-FrameWidth,
|
||||
Self.ClientHeight-FrameWidth);
|
||||
FillRect(ARect);
|
||||
ARect:=Rect(0,0,Self.ClientWidth+1,Self.ClientHeight+1);
|
||||
Pen.Color:=clBlack;
|
||||
Frame3d(ARect, FrameWidth, bvLowered);
|
||||
end;
|
||||
if (Mediator<>nil) and (LookupRoot<>nil) then
|
||||
Mediator.Paint;
|
||||
|
@ -65,7 +65,7 @@ type
|
||||
procedure InvalidateRect(Sender: TObject; ARect: TRect; Erase: boolean);
|
||||
property MyForm: TMyForm read FMyForm;
|
||||
public
|
||||
procedure OiNodeGetImageIndex(APersistent: TPersistent; var AIndex: integer); override;
|
||||
procedure GetObjInspNodeImageIndex(APersistent: TPersistent; var AIndex: integer); override;
|
||||
end;
|
||||
|
||||
{ TFileDescPascalUnitWithMyForm }
|
||||
@ -140,18 +140,18 @@ begin
|
||||
LCLIntf.InvalidateRect(LCLForm.Handle,@ARect,Erase);
|
||||
end;
|
||||
|
||||
procedure TMyWidgetMediator.OiNodeGetImageIndex(APersistent: TPersistent;
|
||||
procedure TMyWidgetMediator.GetObjInspNodeImageIndex(APersistent: TPersistent;
|
||||
var AIndex: integer);
|
||||
begin
|
||||
if Assigned(APersistent) then
|
||||
begin
|
||||
if (APersistent is TMyWidget) and (TMyWidget(APersistent).AcceptChildrenAtDesignTime) then
|
||||
AIndex := 3
|
||||
AIndex := FormEditingHook.GetCurrentObjectInspector.ComponentTree.ImgIndexBox
|
||||
else
|
||||
if (APersistent is TMyWidget) then
|
||||
AIndex := 2
|
||||
AIndex := FormEditingHook.GetCurrentObjectInspector.ComponentTree.ImgIndexControl
|
||||
else
|
||||
inherited OiNodeGetImageIndex(APersistent, AIndex);
|
||||
inherited;
|
||||
end
|
||||
end;
|
||||
|
||||
|
@ -2423,7 +2423,7 @@ begin
|
||||
|
||||
//ask TMediator
|
||||
if DesignerForm is TNonControlDesignerForm then
|
||||
TNonControlDesignerForm(DesignerForm).Mediator.OiNodeGetImageIndex(APersistent, AImageIndex);
|
||||
TNonControlDesignerForm(DesignerForm).Mediator.GetObjInspNodeImageIndex(APersistent, AImageIndex);
|
||||
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user