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