mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-31 13:35:56 +02:00
MG: bugfixes + startet IDE TComponent support
git-svn-id: trunk@235 -
This commit is contained in:
parent
567eee5674
commit
2d564a6c57
@ -68,19 +68,33 @@ type
|
|||||||
|
|
||||||
TSelectedControl = class
|
TSelectedControl = class
|
||||||
private
|
private
|
||||||
FControl:TControl;
|
FComponent:TComponent;
|
||||||
FOldLeft: integer;
|
FOldLeft: integer;
|
||||||
FOldTop: integer;
|
FOldTop: integer;
|
||||||
FOldWidth: integer;
|
FOldWidth: integer;
|
||||||
FOldHeight: integer;
|
FOldHeight: integer;
|
||||||
|
function GetLeft: integer;
|
||||||
|
procedure SetLeft(ALeft: integer);
|
||||||
|
function GetTop: integer;
|
||||||
|
procedure SetTop(ATop: integer);
|
||||||
|
function GetWidth: integer;
|
||||||
|
procedure SetWidth(AWidth: integer);
|
||||||
|
function GetHeight: integer;
|
||||||
|
procedure SetHeight(AHeight: integer);
|
||||||
public
|
public
|
||||||
constructor Create(AControl:TControl);
|
constructor Create(AComponent:TComponent);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property Control:TControl read FControl write FControl;
|
property Component:TComponent read FComponent write FComponent;
|
||||||
|
property Left: integer read GetLeft write SetLeft;
|
||||||
|
property Top: integer read GetTop write SetTop;
|
||||||
|
property Width: integer read GetWidth write SetWidth;
|
||||||
|
property Height: integer read GetHeight write SetHeight;
|
||||||
property OldLeft:integer read FOldLeft write FOldLeft;
|
property OldLeft:integer read FOldLeft write FOldLeft;
|
||||||
property OldTop:integer read FOldTop write FOldTop;
|
property OldTop:integer read FOldTop write FOldTop;
|
||||||
property OldWidth:integer read FOldWidth write FOldWidth;
|
property OldWidth:integer read FOldWidth write FOldWidth;
|
||||||
property OldHeight:integer read FOldHeight write FOldHeight;
|
property OldHeight:integer read FOldHeight write FOldHeight;
|
||||||
|
function ParentForm: TCustomForm;
|
||||||
|
procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||||
procedure SaveBounds;
|
procedure SaveBounds;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -136,14 +150,14 @@ type
|
|||||||
function Count:integer;
|
function Count:integer;
|
||||||
procedure BeginUpDate;
|
procedure BeginUpDate;
|
||||||
procedure EndUpdate;
|
procedure EndUpdate;
|
||||||
function IndexOf(AControl:TControl):integer;
|
function IndexOf(AComponent:TComponent):integer;
|
||||||
function Add(AControl: TControl):integer;
|
function Add(AComponent: TComponent):integer;
|
||||||
procedure Remove(AControl: TControl);
|
procedure Remove(AComponent: TComponent);
|
||||||
procedure Delete(Index:integer);
|
procedure Delete(Index:integer);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure Assign(AControlSelection:TControlSelection);
|
procedure Assign(AControlSelection:TControlSelection);
|
||||||
procedure AdjustSize;
|
procedure AdjustSize;
|
||||||
function IsSelected(AControl: TControl): Boolean;
|
function IsSelected(AComponent: TComponent): Boolean;
|
||||||
procedure SaveBounds;
|
procedure SaveBounds;
|
||||||
procedure MoveSelection(dx, dy: integer);
|
procedure MoveSelection(dx, dy: integer);
|
||||||
procedure SizeSelection(dx, dy: integer);
|
procedure SizeSelection(dx, dy: integer);
|
||||||
@ -157,7 +171,7 @@ type
|
|||||||
property MarkerSize:integer read FMarkerSize write FMarkerSize;
|
property MarkerSize:integer read FMarkerSize write FMarkerSize;
|
||||||
property MarkerColor: TColor read FMarkerColor write FMarkerColor;
|
property MarkerColor: TColor read FMarkerColor write FMarkerColor;
|
||||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||||
procedure DrawMarker(AControl:TControl; DC:HDC);
|
procedure DrawMarker(AComponent:TComponent; DC:HDC);
|
||||||
property ActiveGrabber:TGrabber read FActiveGrabber write SetActiveGrabber;
|
property ActiveGrabber:TGrabber read FActiveGrabber write SetActiveGrabber;
|
||||||
property Left:integer read FLeft;
|
property Left:integer read FLeft;
|
||||||
property Top:integer read FTop;
|
property Top:integer read FTop;
|
||||||
@ -173,7 +187,7 @@ type
|
|||||||
|
|
||||||
var TheControlSelection: TControlSelection;
|
var TheControlSelection: TControlSelection;
|
||||||
|
|
||||||
function GetFormRelativeControlTopLeft(Control: TControl): TPoint;
|
function GetFormRelativeControlTopLeft(Component: TComponent): TPoint;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -195,16 +209,21 @@ const
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
function GetFormRelativeControlTopLeft(Control: TControl): TPoint;
|
function GetFormRelativeControlTopLeft(Component: TComponent): TPoint;
|
||||||
var FormOrigin: TPoint;
|
var FormOrigin: TPoint;
|
||||||
begin
|
begin
|
||||||
if Control.Parent=nil then begin
|
if Component is TControl then begin
|
||||||
Result:=Point(0,0);
|
if TControl(Component).Parent=nil then begin
|
||||||
|
Result:=Point(0,0);
|
||||||
|
end else begin
|
||||||
|
Result:=TControl(Component).Parent.ClientOrigin;
|
||||||
|
FormOrigin:=GetParentForm(TControl(Component)).ClientOrigin;
|
||||||
|
Result.X:=Result.X-FormOrigin.X+TControl(Component).Left;
|
||||||
|
Result.Y:=Result.Y-FormOrigin.Y+TControl(Component).Top;
|
||||||
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
Result:=Control.Parent.ClientOrigin;
|
Result.X:=LongRec(Component.DesignInfo).Lo;
|
||||||
FormOrigin:=GetParentForm(Control).ClientOrigin;
|
Result.Y:=LongRec(Component.DesignInfo).Hi;
|
||||||
Result.X:=Result.X-FormOrigin.X+Control.Left;
|
|
||||||
Result.Y:=Result.Y-FormOrigin.Y+Control.Top;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -222,10 +241,10 @@ end;
|
|||||||
|
|
||||||
{ TSelectedControl }
|
{ TSelectedControl }
|
||||||
|
|
||||||
constructor TSelectedControl.Create(AControl:TControl);
|
constructor TSelectedControl.Create(AComponent:TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FControl:=AControl;
|
FComponent:=AComponent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSelectedControl.Destroy;
|
destructor TSelectedControl.Destroy;
|
||||||
@ -233,16 +252,102 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
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
|
||||||
|
TControl(FComponent).SetBounds(ALeft, ATop, AWidth, AHeight)
|
||||||
|
else begin
|
||||||
|
Left:=ALeft;
|
||||||
|
Top:=ATop;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSelectedControl.SaveBounds;
|
procedure TSelectedControl.SaveBounds;
|
||||||
begin
|
begin
|
||||||
writeln('[TSelectedControl.SaveBounds] ',Control.Name,':',Control.ClassName
|
FOldLeft:=Left;
|
||||||
,' ',Control.Left,',',Control.Top);
|
FOldTop:=Top;
|
||||||
FOldLeft:=Control.Left;
|
FOldWidth:=Width;
|
||||||
FOldTop:=Control.Top;
|
FOldHeight:=Height;
|
||||||
FOldWidth:=Control.Width;
|
writeln('[TSelectedControl.SaveBounds] ',Component.Name,':',Component.ClassName
|
||||||
FOldHeight:=Control.Height;
|
,' ',FOldLeft,',',FOldTop);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSelectedControl.GetLeft: integer;
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
Result:=TControl(FComponent).Left
|
||||||
|
else
|
||||||
|
Result:=LongRec(FComponent.DesignInfo).Lo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSelectedControl.SetLeft(ALeft: integer);
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
TControl(FComponent).Left:=Aleft
|
||||||
|
else
|
||||||
|
LongRec(FComponent.DesignInfo).Lo:=ALeft;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSelectedControl.GetTop: integer;
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
Result:=TControl(FComponent).Top
|
||||||
|
else
|
||||||
|
Result:=LongRec(FComponent.DesignInfo).Hi;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSelectedControl.SetTop(ATop: integer);
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
TControl(FComponent).Top:=ATop
|
||||||
|
else
|
||||||
|
LongRec(FComponent.DesignInfo).Hi:=ATop;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSelectedControl.GetWidth: integer;
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
Result:=TControl(FComponent).Width
|
||||||
|
else
|
||||||
|
Result:=20;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSelectedControl.SetWidth(AWidth: integer);
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
TControl(FComponent).Width:=AWidth
|
||||||
|
else
|
||||||
|
;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSelectedControl.GetHeight: integer;
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
Result:=TControl(FComponent).Height
|
||||||
|
else
|
||||||
|
Result:=20;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSelectedControl.SetHeight(AHeight: integer);
|
||||||
|
begin
|
||||||
|
if FComponent is TControl then
|
||||||
|
TControl(FComponent).Height:=AHeight
|
||||||
|
else
|
||||||
|
;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TControlSelection }
|
{ TControlSelection }
|
||||||
|
|
||||||
constructor TControlSelection.Create;
|
constructor TControlSelection.Create;
|
||||||
@ -296,11 +401,10 @@ end;
|
|||||||
procedure TControlSelection.SetCustomForm;
|
procedure TControlSelection.SetCustomForm;
|
||||||
var NewCustomForm:TCustomForm;
|
var NewCustomForm:TCustomForm;
|
||||||
begin
|
begin
|
||||||
if Count>0 then begin
|
if Count>0 then
|
||||||
NewCustomForm:=GetParentForm(Items[0].Control);
|
NewCustomForm:=Items[0].ParentForm
|
||||||
end else begin
|
else
|
||||||
NewCustomForm:=nil;
|
NewCustomForm:=nil;
|
||||||
end;
|
|
||||||
if NewCustomForm=FCustomForm then exit;
|
if NewCustomForm=FCustomForm then exit;
|
||||||
FCustomForm:=NewCustomForm;
|
FCustomForm:=NewCustomForm;
|
||||||
end;
|
end;
|
||||||
@ -328,13 +432,13 @@ var i:integer;
|
|||||||
begin
|
begin
|
||||||
if FIsResizing then exit;
|
if FIsResizing then exit;
|
||||||
if FControls.Count>=1 then begin
|
if FControls.Count>=1 then begin
|
||||||
LeftTop:=GetFormRelativeControlTopLeft(Items[0].Control);
|
LeftTop:=GetFormRelativeControlTopLeft(Items[0].Component);
|
||||||
FLeft:=LeftTop.X;
|
FLeft:=LeftTop.X;
|
||||||
FTop:=LeftTop.Y;
|
FTop:=LeftTop.Y;
|
||||||
FHeight:=Items[0].Control.Height;
|
FHeight:=Items[0].Height;
|
||||||
FWidth:=Items[0].Control.Width;
|
FWidth:=Items[0].Width;
|
||||||
for i:=1 to FControls.Count-1 do begin
|
for i:=1 to FControls.Count-1 do begin
|
||||||
LeftTop:=GetFormRelativeControlTopLeft(Items[i].Control);
|
LeftTop:=GetFormRelativeControlTopLeft(Items[i].Component);
|
||||||
if FLeft>LeftTop.X then begin
|
if FLeft>LeftTop.X then begin
|
||||||
inc(FWidth,FLeft-LeftTop.X);
|
inc(FWidth,FLeft-LeftTop.X);
|
||||||
FLeft:=LeftTop.X;
|
FLeft:=LeftTop.X;
|
||||||
@ -343,8 +447,8 @@ begin
|
|||||||
inc(FHeight,FTop-LeftTop.Y);
|
inc(FHeight,FTop-LeftTop.Y);
|
||||||
FTop:=LeftTop.Y;
|
FTop:=LeftTop.Y;
|
||||||
end;
|
end;
|
||||||
FWidth:=Max(FLeft+FWidth,LeftTop.X+Items[i].Control.Width)-FLeft;
|
FWidth:=Max(FLeft+FWidth,LeftTop.X+Items[i].Width)-FLeft;
|
||||||
FHeight:=Max(FTop+FHeight,LeftTop.Y+Items[i].Control.Height)-FTop;
|
FHeight:=Max(FTop+FHeight,LeftTop.Y+Items[i].Height)-FTop;
|
||||||
end;
|
end;
|
||||||
AdjustGrabber;
|
AdjustGrabber;
|
||||||
end;
|
end;
|
||||||
@ -424,18 +528,18 @@ begin
|
|||||||
Result:=FControls.Count;
|
Result:=FControls.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControlSelection.IndexOf(AControl:TControl):integer;
|
function TControlSelection.IndexOf(AComponent:TComponent):integer;
|
||||||
begin
|
begin
|
||||||
Result:=Count-1;
|
Result:=Count-1;
|
||||||
while (Result>=0) and (Items[Result].Control<>AControl) do dec(Result);
|
while (Result>=0) and (Items[Result].Component<>AComponent) do dec(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControlSelection.Add(AControl: TControl):integer;
|
function TControlSelection.Add(AComponent: TComponent):integer;
|
||||||
var NewSelectedControl:TSelectedControl;
|
var NewSelectedControl:TSelectedControl;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
NewSelectedControl:=TSelectedControl.Create(AControl);
|
NewSelectedControl:=TSelectedControl.Create(AComponent);
|
||||||
if GetParentForm(AControl)<>FCustomForm then Clear;
|
if NewSelectedControl.ParentForm<>FCustomForm then Clear;
|
||||||
Result:=FControls.Add(NewSelectedControl);
|
Result:=FControls.Add(NewSelectedControl);
|
||||||
if Count=1 then SetCustomForm;
|
if Count=1 then SetCustomForm;
|
||||||
AdjustSize;
|
AdjustSize;
|
||||||
@ -443,10 +547,10 @@ begin
|
|||||||
DoChange;
|
DoChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlSelection.Remove(AControl: TControl);
|
procedure TControlSelection.Remove(AComponent: TComponent);
|
||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
i:=IndexOf(AControl);
|
i:=IndexOf(AComponent);
|
||||||
if i>=0 then Delete(i);
|
if i>=0 then Delete(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -474,18 +578,20 @@ procedure TControlSelection.Assign(AControlSelection:TControlSelection);
|
|||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
if AControlSelection=Self then exit;
|
if AControlSelection=Self then exit;
|
||||||
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
FControls.Capacity:=AControlSelection.Count;
|
FControls.Capacity:=AControlSelection.Count;
|
||||||
for i:=0 to AControlSelection.Count-1 do
|
for i:=0 to AControlSelection.Count-1 do
|
||||||
Add(AControlSelection[i].Control);
|
Add(AControlSelection[i].Component);
|
||||||
SetCustomForm;
|
SetCustomForm;
|
||||||
AdjustSize;
|
AdjustSize;
|
||||||
|
EndUpdate;
|
||||||
DoChange;
|
DoChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControlSelection.IsSelected(AControl: TControl): Boolean;
|
function TControlSelection.IsSelected(AComponent: TComponent): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(IndexOf(AControl)>=0);
|
Result:=(IndexOf(AComponent)>=0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlSelection.MoveSelection(dx, dy: integer);
|
procedure TControlSelection.MoveSelection(dx, dy: integer);
|
||||||
@ -498,7 +604,7 @@ begin
|
|||||||
for i:=0 to FControls.Count-1 do begin
|
for i:=0 to FControls.Count-1 do begin
|
||||||
with Items[i] do begin
|
with Items[i] do begin
|
||||||
writeln('TControlSelection.MoveSelection ',i,' ',OldLeft,',',OldTop,' d=',dx,',',dy);
|
writeln('TControlSelection.MoveSelection ',i,' ',OldLeft,',',OldTop,' d=',dx,',',dy);
|
||||||
Control.SetBounds(OldLeft+dx,OldTop+dy,Control.Width,Control.Height);
|
SetBounds(OldLeft+dx,OldTop+dy,Width,Height)
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
for g:=Low(TGrabIndex) to High(TGrabIndex) do begin
|
for g:=Low(TGrabIndex) to High(TGrabIndex) do begin
|
||||||
@ -543,12 +649,12 @@ begin
|
|||||||
AdjustGrabber;
|
AdjustGrabber;
|
||||||
if Count=1 then begin
|
if Count=1 then begin
|
||||||
// single selection
|
// single selection
|
||||||
Items[0].Control.SetBounds(FLeft,FTop,FWidth,FHeight);
|
Items[0].SetBounds(FLeft,FTop,FWidth,FHeight);
|
||||||
end else if Count>1 then begin
|
end else if Count>1 then begin
|
||||||
// multi selection
|
// multi selection
|
||||||
if (FOldWidth<>0) and (FOldHeight<>0) then begin
|
if (FOldWidth<>0) and (FOldHeight<>0) then begin
|
||||||
for i:=0 to Count-1 do begin
|
for i:=0 to Count-1 do begin
|
||||||
Items[i].Control.SetBounds(
|
Items[i].SetBounds(
|
||||||
FOldLeft + (((Items[i].OldLeft-FOldLeft) * FWidth) div FOldWidth),
|
FOldLeft + (((Items[i].OldLeft-FOldLeft) * FWidth) div FOldWidth),
|
||||||
FOldTop + (((Items[i].OldTop-FOldTop) * FHeight) div FOldHeight),
|
FOldTop + (((Items[i].OldTop-FOldTop) * FHeight) div FOldHeight),
|
||||||
Max(1,Abs((Items[i].OldWidth * FWidth) div FOldWidth)),
|
Max(1,Abs((Items[i].OldWidth * FWidth) div FOldWidth)),
|
||||||
@ -585,7 +691,7 @@ var OldBrushColor:TColor;
|
|||||||
// OldFormHandle: HDC;
|
// OldFormHandle: HDC;
|
||||||
begin
|
begin
|
||||||
if (Count=0) or (FCustomForm=nil)
|
if (Count=0) or (FCustomForm=nil)
|
||||||
or (Items[0].Control is TCustomForm) then exit;
|
or (Items[0].Component is TCustomForm) then exit;
|
||||||
GetWindowOrgEx(DC, DCOrigin);
|
GetWindowOrgEx(DC, DCOrigin);
|
||||||
FormOrigin:=FCustomForm.ClientOrigin;
|
FormOrigin:=FCustomForm.ClientOrigin;
|
||||||
Diff.X:=FormOrigin.X-DCOrigin.X;
|
Diff.X:=FormOrigin.X-DCOrigin.X;
|
||||||
@ -616,25 +722,33 @@ writeln('[DrawGrabbers] Form=',FormOrigin.X,',',FormOrigin.Y
|
|||||||
// FCustomForm.Canvas.Handle:=OldFormHandle;
|
// FCustomForm.Canvas.Handle:=OldFormHandle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlSelection.DrawMarker(AControl:TControl; DC:HDC);
|
procedure TControlSelection.DrawMarker(AComponent:TComponent; DC:HDC);
|
||||||
var OldBrushColor:TColor;
|
var OldBrushColor:TColor;
|
||||||
ALeft,ATop:integer;
|
ALeft,ATop:integer;
|
||||||
AControlOrigin,DCOrigin:TPoint;
|
AControlOrigin,DCOrigin:TPoint;
|
||||||
SaveIndex:HDC;
|
SaveIndex:HDC;
|
||||||
// OldFormHandle:HDC;
|
AControl: TControl;
|
||||||
begin
|
begin
|
||||||
if (Count<2) or (FCustomForm=nil) or (AControl is TCustomForm)
|
if (Count<2) or (FCustomForm=nil) or (AComponent is TCustomForm)
|
||||||
or (not IsSelected(AControl)) then exit;
|
or (not IsSelected(AComponent)) then exit;
|
||||||
AControlOrigin:=AControl.Parent.ClientOrigin;
|
if AComponent is TControl then begin
|
||||||
Inc(AControlOrigin.X,AControl.Left);
|
AControl:=TControl(AComponent);
|
||||||
Inc(AControlOrigin.Y,AControl.Top);
|
AControlOrigin:=AControl.Parent.ClientOrigin;
|
||||||
|
Inc(AControlOrigin.X,AControl.Left);
|
||||||
|
Inc(AControlOrigin.Y,AControl.Top);
|
||||||
|
end else begin
|
||||||
|
if (not (AComponent.Owner is TCustomForm)) then exit;
|
||||||
|
AControlOrigin:=TCustomForm(AComponent.Owner).ClientOrigin;
|
||||||
|
inc(AControlOrigin.X,LongRec(AComponent.DesignInfo).Lo);
|
||||||
|
inc(AControlOrigin.Y,LongRec(AComponent.DesignInfo).Hi);
|
||||||
|
end;
|
||||||
GetWindowOrgEx(DC, DCOrigin);
|
GetWindowOrgEx(DC, DCOrigin);
|
||||||
// MoveWindowOrg is currently not functioning in the gtk
|
// MoveWindowOrg is currently not functioning in the gtk
|
||||||
// this is a workaround
|
// this is a workaround
|
||||||
ALeft:=AControlOrigin.X-DCOrigin.X;
|
ALeft:=AControlOrigin.X-DCOrigin.X;
|
||||||
ATop:=AControlOrigin.Y-DCOrigin.Y;
|
ATop:=AControlOrigin.Y-DCOrigin.Y;
|
||||||
|
|
||||||
SaveIndex := SaveDC(DC);
|
SaveIndex := SaveDC(DC);
|
||||||
// OldFormHandle:=FCustomForm.Canvas.Handle;
|
|
||||||
FCanvas.Handle:=DC;
|
FCanvas.Handle:=DC;
|
||||||
{
|
{
|
||||||
writeln('DrawMarker A ',FCustomForm.Name
|
writeln('DrawMarker A ',FCustomForm.Name
|
||||||
@ -657,7 +771,6 @@ writeln('DrawMarker A ',FCustomForm.Name
|
|||||||
Brush.Color:=OldbrushColor;
|
Brush.Color:=OldbrushColor;
|
||||||
end;
|
end;
|
||||||
FCanvas.Handle:=0;
|
FCanvas.Handle:=0;
|
||||||
// FCustomForm.Canvas.Handle:=OldFormHandle;
|
|
||||||
RestoreDC(DC, SaveIndex);
|
RestoreDC(DC, SaveIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -286,7 +286,8 @@ Begin
|
|||||||
ControlSelection.BeginUpdate;
|
ControlSelection.BeginUpdate;
|
||||||
ControlSelection.Clear;
|
ControlSelection.Clear;
|
||||||
for i:=0 to AControlSelection.Count-1 do
|
for i:=0 to AControlSelection.Count-1 do
|
||||||
AControlSelection[i].Control.Invalidate;
|
if AControlSelection[i].Component is TControl then
|
||||||
|
TControl(AControlSelection[i].Component).Invalidate;
|
||||||
ControlSelection.Add(Sender);
|
ControlSelection.Add(Sender);
|
||||||
ControlSelection.EndUpdate;
|
ControlSelection.EndUpdate;
|
||||||
Sender.Invalidate;
|
Sender.Invalidate;
|
||||||
@ -356,7 +357,7 @@ Begin
|
|||||||
ControlSelection.BeginUpdate;
|
ControlSelection.BeginUpdate;
|
||||||
if (not (ssShift in Shift))
|
if (not (ssShift in Shift))
|
||||||
or ((ControlSelection.Count=1)
|
or ((ControlSelection.Count=1)
|
||||||
and (ControlSelection[0].Control is TCustomForm)) then
|
and (ControlSelection[0].Component is TCustomForm)) then
|
||||||
ControlSelection.Clear;
|
ControlSelection.Clear;
|
||||||
if RubberBandWasActive then begin
|
if RubberBandWasActive then begin
|
||||||
ControlSelection.SelectWithRubberBand(SenderParentForm,ssShift in Shift);
|
ControlSelection.SelectWithRubberBand(SenderParentForm,ssShift in Shift);
|
||||||
@ -478,7 +479,7 @@ Begin
|
|||||||
end else begin
|
end else begin
|
||||||
if (Message.keys and MK_LButton) = MK_LButton then begin
|
if (Message.keys and MK_LButton) = MK_LButton then begin
|
||||||
if (not (MouseDownControl is TCustomForm)) and (ControlSelection.Count>=1)
|
if (not (MouseDownControl is TCustomForm)) and (ControlSelection.Count>=1)
|
||||||
and not (ControlSelection[0].Control is TCustomForm) then begin
|
and not (ControlSelection[0].Component is TCustomForm) then begin
|
||||||
// move selection
|
// move selection
|
||||||
FHasSized:=true;
|
FHasSized:=true;
|
||||||
ControlSelection.MoveSelection(
|
ControlSelection.MoveSelection(
|
||||||
@ -523,7 +524,7 @@ Writeln('KEYDOWN');
|
|||||||
ControlSelection.BeginUpdate;
|
ControlSelection.BeginUpdate;
|
||||||
for I := ControlSelection.Count-1 downto 0 do Begin
|
for I := ControlSelection.Count-1 downto 0 do Begin
|
||||||
Writeln('I = '+inttostr(i));
|
Writeln('I = '+inttostr(i));
|
||||||
RemoveControl(ControlSelection.Items[I].Control);
|
RemoveControl(ControlSelection.Items[I].Component);
|
||||||
End;
|
End;
|
||||||
SelectOnlythisComponent(FCustomForm);
|
SelectOnlythisComponent(FCustomForm);
|
||||||
ControlSelection.EndUpdate;
|
ControlSelection.EndUpdate;
|
||||||
@ -614,7 +615,7 @@ Begin
|
|||||||
writeln('[TDesigner.Notification] opRemove '+
|
writeln('[TDesigner.Notification] opRemove '+
|
||||||
''''+AComponent.ClassName+'.'+AComponent.Name+'''');
|
''''+AComponent.ClassName+'.'+AComponent.Name+'''');
|
||||||
if (AComponent is TControl) then
|
if (AComponent is TControl) then
|
||||||
if ControlSelection.IsSelected(TControl(AComponent)) then
|
if ControlSelection.IsSelected(TControl(AComponent)) then
|
||||||
ControlSelection.Remove(TControl(AComponent));
|
ControlSelection.Remove(TControl(AComponent));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -732,15 +732,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOIPropertyGrid.ShrinkRow(Index:integer);
|
procedure TOIPropertyGrid.ShrinkRow(Index:integer);
|
||||||
var CurRow:TOIPropertyGridRow;
|
var CurRow, ARow:TOIPropertyGridRow;
|
||||||
StartIndex,EndIndex,a:integer;
|
StartIndex,EndIndex,a:integer;
|
||||||
CurPath:string;
|
CurPath:string;
|
||||||
begin
|
begin
|
||||||
CurRow:=Rows[Index];
|
CurRow:=Rows[Index];
|
||||||
if (not CurRow.Expanded) then exit;
|
if (not CurRow.Expanded) then exit;
|
||||||
if CurRow.NextBrother=nil then StartIndex:=FRows.Count-1
|
|
||||||
else StartIndex:=CurRow.NextBrother.Index-1;
|
|
||||||
EndIndex:=CurRow.Index+1;
|
EndIndex:=CurRow.Index+1;
|
||||||
|
StartIndex:=FRows.Count-1;
|
||||||
|
ARow:=CurRow;
|
||||||
|
while ARow<>nil do begin
|
||||||
|
if ARow.NextBrother<>nil then begin
|
||||||
|
StartIndex:=ARow.NextBrother.Index-1;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
ARow:=ARow.Parent;
|
||||||
|
end;
|
||||||
for a:=StartIndex downto EndIndex do begin
|
for a:=StartIndex downto EndIndex do begin
|
||||||
Rows[a].Free;
|
Rows[a].Free;
|
||||||
FRows.Delete(a);
|
FRows.Delete(a);
|
||||||
|
@ -200,12 +200,12 @@ type
|
|||||||
FBorderWidth:integer;
|
FBorderWidth:integer;
|
||||||
protected
|
protected
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure MouseDown(Button:TMouseButton; Shift:TShiftState;
|
|
||||||
X,Y:integer); override;
|
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
procedure SetButtonColor(Value:TColor);
|
procedure SetButtonColor(Value:TColor);
|
||||||
|
public
|
||||||
|
constructor Create(AOwner : TComponent); override;
|
||||||
|
destructor Destroy; Override;
|
||||||
published
|
published
|
||||||
property BorderWidth:integer read FBorderWidth write FBorderWidth;
|
property BorderWidth:integer read FBorderWidth write FBorderWidth;
|
||||||
property ButtonColor:TColor read FButtonColor write SetButtonColor;
|
property ButtonColor:TColor read FButtonColor write SetButtonColor;
|
||||||
@ -919,40 +919,51 @@ end;
|
|||||||
|
|
||||||
{ TColorButton }
|
{ TColorButton }
|
||||||
|
|
||||||
|
constructor TColorButton.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
Inherited Create(AOwner);
|
||||||
|
Align := alNone;
|
||||||
|
FBorderWidth:=2;
|
||||||
|
Setbounds(1,1,75,25);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TColorButton.Destroy;
|
||||||
|
Begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TColorButton.Paint;
|
procedure TColorButton.Paint;
|
||||||
var PaintRect:TRect;
|
var a: integer;
|
||||||
begin
|
begin
|
||||||
//inherited Paint;
|
//inherited Paint;
|
||||||
PaintRect := Bounds(Left, Top, Width, Height);
|
|
||||||
with Canvas do begin
|
with Canvas do begin
|
||||||
Brush.Color:=ButtonColor;
|
Brush.Color:=ButtonColor;
|
||||||
FillRect(PaintRect);
|
FillRect(Bounds(0, 0, Width, Height));
|
||||||
|
Pen.Color:=clWhite;
|
||||||
|
for a:=0 to FBorderWidth-1 do begin
|
||||||
|
MoveTo(a,Height-a);
|
||||||
|
LineTo(a,a);
|
||||||
|
LineTo(Width-a,a);
|
||||||
|
end;
|
||||||
|
Pen.Color:=clBlack;
|
||||||
|
for a:=0 to FBorderWidth-1 do begin
|
||||||
|
MoveTo(Width-a-1,a);
|
||||||
|
LineTo(Width-a-1,Height-a-1);
|
||||||
|
MoveTo(a,Height-a-1);
|
||||||
|
LineTo(Width-a,Height-a-1);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
DrawFrameControl(Canvas.Handle, PaintRect, DFC_BUTTON
|
|
||||||
,DFCS_BUTTONPUSH or DFCS_ADJUSTRECT);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColorButton.SetButtonColor(Value:TColor);
|
procedure TColorButton.SetButtonColor(Value:TColor);
|
||||||
begin
|
begin
|
||||||
if Value=FButtonColor then exit;
|
if Value=FButtonColor then exit;
|
||||||
FButtonColor:=Value;
|
FButtonColor:=Value;
|
||||||
if Assigned(FOnColorChanged) then begin
|
if Assigned(FOnColorChanged) then
|
||||||
FOnColorChanged(Self);
|
FOnColorChanged(Self);
|
||||||
end;
|
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColorButton.MouseDown(Button:TMouseButton; Shift:TShiftState;
|
|
||||||
X,Y:integer);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TColorButton.MouseMove(Shift: TShiftState; X, Y: Integer);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TColorButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure TColorButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
var NewColor:TColor;
|
var NewColor:TColor;
|
||||||
|
15
ide/main.pp
15
ide/main.pp
@ -635,6 +635,7 @@ end;
|
|||||||
|
|
||||||
destructor TMainIDE.Destroy;
|
destructor TMainIDE.Destroy;
|
||||||
begin
|
begin
|
||||||
|
writeln('[TMainIDE.Destroy] 1');
|
||||||
if Project<>nil then begin
|
if Project<>nil then begin
|
||||||
Project.Free;
|
Project.Free;
|
||||||
Project:=nil;
|
Project:=nil;
|
||||||
@ -642,6 +643,7 @@ begin
|
|||||||
TheControlSelection.OnChange:=nil;
|
TheControlSelection.OnChange:=nil;
|
||||||
TheControlSelection.Free;
|
TheControlSelection.Free;
|
||||||
TheControlSelection:=nil;
|
TheControlSelection:=nil;
|
||||||
|
writeln('[TMainIDE.Destroy] 2');
|
||||||
FormEditor1.Free;
|
FormEditor1.Free;
|
||||||
FormEditor1:=nil;
|
FormEditor1:=nil;
|
||||||
PropertyEditorHook1.Free;
|
PropertyEditorHook1.Free;
|
||||||
@ -649,7 +651,9 @@ begin
|
|||||||
MacroList.Free;
|
MacroList.Free;
|
||||||
EnvironmentOptions.Free;
|
EnvironmentOptions.Free;
|
||||||
EnvironmentOptions:=nil;
|
EnvironmentOptions:=nil;
|
||||||
|
writeln('[TMainIDE.Destroy] 3');
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
writeln('[TMainIDE.Destroy] END');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OIOnAddAvailableComponent(AComponent:TComponent;
|
procedure TMainIDE.OIOnAddAvailableComponent(AComponent:TComponent;
|
||||||
@ -1360,7 +1364,9 @@ var CanClose: boolean;
|
|||||||
begin
|
begin
|
||||||
CanClose:=true;
|
CanClose:=true;
|
||||||
OnCloseQuery(Sender, CanClose);
|
OnCloseQuery(Sender, CanClose);
|
||||||
|
writeln('TMainIDE.mnuQuitClicked 1');
|
||||||
if CanClose then Close;
|
if CanClose then Close;
|
||||||
|
writeln('TMainIDE.mnuQuitClicked 2');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -1873,6 +1879,9 @@ writeln('TMainIDE.DoCloseEditorUnit 1');
|
|||||||
end;
|
end;
|
||||||
// close form
|
// close form
|
||||||
if ActiveUnitInfo.Form<>nil then begin
|
if ActiveUnitInfo.Form<>nil then begin
|
||||||
|
for i:=0 to TWinControl(ActiveUnitInfo.Form).ComponentCount-1 do
|
||||||
|
TheControlSelection.Remove(
|
||||||
|
TWinControl(ActiveUnitInfo.Form).Components[i]);
|
||||||
TheControlSelection.Remove(TControl(ActiveUnitInfo.Form));
|
TheControlSelection.Remove(TControl(ActiveUnitInfo.Form));
|
||||||
OldDesigner:=TDesigner(TCustomForm(ActiveUnitInfo.Form).Designer);
|
OldDesigner:=TDesigner(TCustomForm(ActiveUnitInfo.Form).Designer);
|
||||||
FormEditor1.DeleteControl(ActiveUnitInfo.Form);
|
FormEditor1.DeleteControl(ActiveUnitInfo.Form);
|
||||||
@ -2931,7 +2940,7 @@ begin
|
|||||||
writeln('[TMainIDE.OnControlSelectionChanged]');
|
writeln('[TMainIDE.OnControlSelectionChanged]');
|
||||||
NewSelectedComponents:=TComponentSelectionList.Create;
|
NewSelectedComponents:=TComponentSelectionList.Create;
|
||||||
for i:=0 to TheControlSelection.Count-1 do begin
|
for i:=0 to TheControlSelection.Count-1 do begin
|
||||||
NewSelectedComponents.Add(TheControlSelection[i].Control);
|
NewSelectedComponents.Add(TheControlSelection[i].Component);
|
||||||
end;
|
end;
|
||||||
FormEditor1.SelectedComponents:=NewSelectedComponents;
|
FormEditor1.SelectedComponents:=NewSelectedComponents;
|
||||||
end;
|
end;
|
||||||
@ -2948,8 +2957,8 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.79 2001/03/21 23:48:28 lazarus
|
Revision 1.80 2001/03/22 17:57:34 lazarus
|
||||||
MG: fixed window positions
|
MG: bugfixes + startet IDE TComponent support
|
||||||
|
|
||||||
Revision 1.75 2001/03/19 14:00:46 lazarus
|
Revision 1.75 2001/03/19 14:00:46 lazarus
|
||||||
MG: fixed many unreleased DC and GDIObj bugs
|
MG: fixed many unreleased DC and GDIObj bugs
|
||||||
|
Loading…
Reference in New Issue
Block a user