mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 02:00:28 +02:00
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...
git-svn-id: trunk@1754 -
This commit is contained in:
parent
48c4518d3c
commit
1d603e185c
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,8 @@ unit Designer;
|
||||
|
||||
interface
|
||||
|
||||
{$DEFINE VerboseDesigner}
|
||||
|
||||
uses
|
||||
Classes, LCLType, LCLLinux, Forms, Controls, LMessages, Graphics,
|
||||
ControlSelection, CustomFormEditor, FormEditor, UnitEditor, CompReg, Menus,
|
||||
@ -86,14 +88,14 @@ type
|
||||
FHintTimer : TTimer;
|
||||
FHintWIndow : THintWindow;
|
||||
|
||||
function GetDisplayGrid: boolean;
|
||||
function GetShowGrid: boolean;
|
||||
function GetGridSizeX: integer;
|
||||
function GetGridSizeY: integer;
|
||||
function GetIsControl: Boolean;
|
||||
function GetSnapToGrid: boolean;
|
||||
Procedure HintTimer(sender : TObject);
|
||||
procedure InvalidateWithParent(AComponent: TComponent);
|
||||
procedure SetDisplayGrid(const AValue: boolean);
|
||||
procedure SetShowGrid(const AValue: boolean);
|
||||
procedure SetGridSizeX(const AValue: integer);
|
||||
procedure SetGridSizeY(const AValue: integer);
|
||||
procedure SetIsControl(Value: Boolean);
|
||||
@ -105,20 +107,19 @@ type
|
||||
MouseUpPos: TPoint;
|
||||
LastMouseMovePos: TPoint;
|
||||
|
||||
function PaintControl(Sender: TControl; Message: TLMPaint):boolean;
|
||||
function SizeControl(Sender: TControl; Message: TLMSize):boolean;
|
||||
function MoveControl(Sender: TControl; Message: TLMMove):boolean;
|
||||
Procedure MouseDownOnControl(Sender: TControl; Message : TLMMouse);
|
||||
Procedure MouseMoveOnControl(Sender: TControl; var Message : TLMMouse);
|
||||
Procedure MouseLeftUpOnControl(Sender: TControl; Message:TLMMouse);
|
||||
Procedure MouseRightUpOnControl(Sender: TControl; Message:TLMMouse);
|
||||
Procedure KeyDown(Sender: TControl; Message:TLMKEY);
|
||||
Procedure KeyUp(Sender: TControl; Message:TLMKEY);
|
||||
function PaintControl(Sender: TControl; TheMessage: TLMPaint):boolean;
|
||||
function SizeControl(Sender: TControl; TheMessage: TLMSize):boolean;
|
||||
function MoveControl(Sender: TControl; TheMessage: TLMMove):boolean;
|
||||
Procedure MouseDownOnControl(Sender: TControl; TheMessage : TLMMouse);
|
||||
Procedure MouseMoveOnControl(Sender: TControl; var TheMessage: TLMMouse);
|
||||
Procedure MouseLeftUpOnControl(Sender: TControl; TheMessage:TLMMouse);
|
||||
Procedure MouseRightUpOnControl(Sender: TControl; TheMessage:TLMMouse);
|
||||
Procedure KeyDown(Sender: TControl; TheMessage:TLMKEY);
|
||||
Procedure KeyUp(Sender: TControl; TheMessage:TLMKEY);
|
||||
|
||||
Procedure RemoveControl(Control: TComponent);
|
||||
Procedure NudgeControl(DiffX, DiffY: Integer);
|
||||
Procedure NudgeSize(DiffX, DiffY: Integer);
|
||||
procedure MoveSelection(DiffX, DiffY: integer);
|
||||
|
||||
procedure BuildPopupMenu;
|
||||
procedure OnAlignPopupMenuClick(Sender: TObject);
|
||||
@ -134,7 +135,7 @@ type
|
||||
constructor Create(Customform : TCustomform; AControlSelection: TControlSelection);
|
||||
destructor Destroy; override;
|
||||
|
||||
function IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean; override;
|
||||
function IsDesignMsg(Sender: TControl; var TheMessage: TLMessage): Boolean; override;
|
||||
procedure Modified; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure PaintGrid; override;
|
||||
@ -144,7 +145,7 @@ type
|
||||
function NonVisualComponentAtPos(x,y: integer): TComponent;
|
||||
procedure DrawNonVisualComponents(DC: HDC);
|
||||
|
||||
property DisplayGrid: boolean read GetDisplayGrid write SetDisplayGrid;
|
||||
property ShowGrid: boolean read GetShowGrid write SetShowGrid;
|
||||
property Form: TCustomForm read FCustomForm write FCustomForm;
|
||||
property FormEditor: TFormEditor read FFormEditor write FFormEditor;
|
||||
property GridSizeX: integer read GetGridSizeX write SetGridSizeX;
|
||||
@ -179,7 +180,7 @@ implementation
|
||||
|
||||
|
||||
uses
|
||||
Sysutils, Math;
|
||||
SysUtils, Math;
|
||||
|
||||
const
|
||||
mk_lbutton = 1;
|
||||
@ -250,19 +251,6 @@ Begin
|
||||
ControlSelection.SizeSelection(DiffX, DiffY);
|
||||
end;
|
||||
|
||||
procedure TDesigner.MoveSelection(DiffX, DiffY: integer);
|
||||
//var
|
||||
// StepX, StepY: integer;
|
||||
begin
|
||||
{if SnapToGrid then begin
|
||||
StepX:=GridSizeX;
|
||||
StepY:=GridSizeY;
|
||||
DiffX:=DiffX+(StepX div 2)-(DiffX mod StepX);
|
||||
DiffY:=DiffY+(StepY div 2)-(DiffY mod StepY);
|
||||
end;}
|
||||
ControlSelection.MoveSelection(DiffX,DiffY);
|
||||
end;
|
||||
|
||||
procedure TDesigner.SelectOnlyThisComponent(AComponent:TComponent);
|
||||
begin
|
||||
ControlSelection.BeginUpdate;
|
||||
@ -286,7 +274,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDesigner.PaintControl(Sender: TControl; Message: TLMPaint):boolean;
|
||||
function TDesigner.PaintControl(Sender: TControl; TheMessage: TLMPaint):boolean;
|
||||
var OldDuringPaintControl: boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
@ -294,113 +282,114 @@ begin
|
||||
//writeln('*** LM_PAINT A ',Sender.Name,':',Sender.ClassName,' DC=',HexStr(Message.DC,8));
|
||||
OldDuringPaintControl:=FDuringPaintControl;
|
||||
FDuringPaintControl:=true;
|
||||
Sender.Dispatch(Message);
|
||||
Sender.Dispatch(TheMessage);
|
||||
|
||||
|
||||
//writeln('*** LM_PAINT B ',Sender.Name,':',Sender.ClassName,' DC=',HexStr(Message.DC,8));
|
||||
if (ControlSelection.IsSelected(Sender)) then begin
|
||||
// writeln('*** LM_PAINT ',Sender.Name,':',Sender.ClassName,' DC=',HexStr(Message.DC,8));
|
||||
ControlSelection.DrawMarker(Sender,Message.DC);
|
||||
ControlSelection.DrawMarker(Sender,TheMessage.DC);
|
||||
end;
|
||||
//if OldDuringPaintControl=false then begin
|
||||
DrawNonVisualComponents(Message.DC);
|
||||
ControlSelection.DrawGrabbers(Message.DC);
|
||||
DrawNonVisualComponents(TheMessage.DC);
|
||||
ControlSelection.DrawGrabbers(TheMessage.DC);
|
||||
ControlSelection.DrawGuideLines(TheMessage.DC);
|
||||
if ControlSelection.RubberBandActive then
|
||||
ControlSelection.DrawRubberBand(Message.DC);
|
||||
ControlSelection.DrawRubberBand(TheMessage.DC);
|
||||
// end;
|
||||
FDuringPaintControl:=OldDuringPaintControl;
|
||||
end;
|
||||
|
||||
function TDesigner.SizeControl(Sender: TControl; Message: TLMSize):boolean;
|
||||
function TDesigner.SizeControl(Sender: TControl; TheMessage: TLMSize):boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
Sender.Dispatch(Message);
|
||||
Sender.Dispatch(TheMessage);
|
||||
if (ControlSelection.IsSelected(Sender)) then begin
|
||||
// writeln('*** LM_Size ',Sender.Name,':',Sender.ClassName,' Type=',Message.SizeType
|
||||
// ,' ',Message.Width,',',Message.Height,' Pos=',Sender.Left,',',Sender.Top);
|
||||
{writeln('### TDesigner.SizeControl ',Sender.Name,':',Sender.ClassName,
|
||||
' ',Sender.Width,',',Sender.Height,
|
||||
' Type=',TheMessage.SizeType
|
||||
,' ',TheMessage.Width,',',TheMessage.Height,' Pos=',Sender.Left,',',Sender.Top);}
|
||||
if not ControlSelection.IsResizing then begin
|
||||
ControlSelection.AdjustSize;
|
||||
ControlSelection.UpdateBounds;
|
||||
if Assigned(FOnPropertiesChanged) then
|
||||
FOnPropertiesChanged(Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDesigner.MoveControl(Sender: TControl; Message: TLMMove):boolean;
|
||||
function TDesigner.MoveControl(Sender: TControl; TheMessage: TLMMove):boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
Sender.Dispatch(Message);
|
||||
Sender.Dispatch(TheMessage);
|
||||
if (ControlSelection.IsSelected(Sender)) then begin
|
||||
// writeln('*** LM_Move ',Sender.Name,':',Sender.ClassName);
|
||||
ControlSelection.AdjustSize;
|
||||
ControlSelection.UpdateBounds;
|
||||
if Assigned(FOnPropertiesChanged) then
|
||||
FOnPropertiesChanged(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDesigner.MouseDownOnControl(Sender : TControl; Message : TLMMouse);
|
||||
procedure TDesigner.MouseDownOnControl(Sender: TControl; TheMessage: TLMMouse);
|
||||
var i,
|
||||
MouseX,MouseY,
|
||||
CompIndex:integer;
|
||||
SenderOrigin:TPoint;
|
||||
AControlSelection:TControlSelection;
|
||||
SenderClientOrigin:TPoint;
|
||||
SelectedCompClass: TRegisteredComponent;
|
||||
NonVisualComp: TComponent;
|
||||
Begin
|
||||
FHintTimer.Enabled := False;
|
||||
FHasSized:=false;
|
||||
if (MouseDownComponent<>nil) or (getParentForm(Sender)=nil) then exit;
|
||||
MouseDownComponent:=Sender;
|
||||
MouseDownSender:=Sender;
|
||||
if (getParentForm(Sender)=nil) then exit;
|
||||
|
||||
if MouseDownComponent=nil then begin
|
||||
MouseDownComponent:=Sender;
|
||||
MouseDownSender:=Sender;
|
||||
end;
|
||||
|
||||
SenderOrigin:=GetFormRelativeControlTopLeft(Sender);
|
||||
MouseX:=Message.Pos.X+SenderOrigin.X;
|
||||
MouseY:=Message.Pos.Y+SenderOrigin.Y;
|
||||
|
||||
MouseDownPos := Point(MouseX,MouseY);
|
||||
SenderClientOrigin:=GetParentFormRelativeClientOrigin(Sender);
|
||||
MouseDownPos := Point(TheMessage.Pos.X+SenderClientOrigin.X,
|
||||
TheMessage.Pos.Y+SenderClientOrigin.Y);
|
||||
LastMouseMovePos:=MouseDownPos;
|
||||
|
||||
{$IFDEF VerboseDesigner}
|
||||
writeln('************************************************************');
|
||||
write('MouseDownOnControl');
|
||||
write(' ',Sender.Name,':',Sender.ClassName,' Origin=',SenderOrigin.X,',',SenderOrigin.Y);
|
||||
write(' Msg=',Message.Pos.X,',',Message.Pos.Y);
|
||||
write(' Mouse=',MouseX,',',MouseY);
|
||||
write(' ',Sender.Name,':',Sender.ClassName,
|
||||
' ClientOrg=',SenderClientOrigin.X,',',SenderClientOrigin.Y);
|
||||
write(' Msg=',TheMessage.Pos.X,',',TheMessage.Pos.Y);
|
||||
write(' Mouse=',MouseDownPos.X,',',MouseDownPos.Y);
|
||||
writeln('');
|
||||
|
||||
if (Message.Keys and MK_Shift) = MK_Shift then
|
||||
if (TheMessage.Keys and MK_Shift) = MK_Shift then
|
||||
Write(' Shift down')
|
||||
else
|
||||
Write(' No Shift down');
|
||||
|
||||
if (Message.Keys and MK_Control) = MK_Control then
|
||||
if (TheMessage.Keys and MK_Control) = MK_Control then
|
||||
Writeln(', CTRL down')
|
||||
else
|
||||
Writeln(', No CTRL down');
|
||||
{$ENDIF}
|
||||
|
||||
if (Message.Keys and MK_LButton) > 0 then begin
|
||||
ControlSelection.ActiveGrabber:=
|
||||
ControlSelection.GrabberAtPos(MouseDownPos.X,MouseDownPos.Y)
|
||||
end else
|
||||
ControlSelection.ActiveGrabber:=nil;
|
||||
|
||||
SelectedCompClass:=nil;
|
||||
if Assigned(FOnGetSelectedComponentClass) then
|
||||
FOnGetSelectedComponentClass(Self,SelectedCompClass)
|
||||
else
|
||||
SelectedCompClass:=nil;
|
||||
FOnGetSelectedComponentClass(Self,SelectedCompClass);
|
||||
|
||||
if (Message.Keys and MK_LButton) > 0 then begin
|
||||
if (TheMessage.Keys and MK_LButton) > 0 then begin
|
||||
// left button
|
||||
// -> check if a grabber was activated
|
||||
ControlSelection.ActiveGrabber:=
|
||||
ControlSelection.GrabberAtPos(MouseDownPos.X,MouseDownPos.Y);
|
||||
|
||||
if SelectedCompClass = nil then begin
|
||||
// selection mode
|
||||
if ControlSelection.ActiveGrabber=nil then begin
|
||||
NonVisualComp:=NonVisualComponentAtPos(
|
||||
MouseDownPos.X,MouseDownPos.Y);
|
||||
NonVisualComp:=NonVisualComponentAtPos(MouseDownPos.X,MouseDownPos.Y);
|
||||
if NonVisualComp<>nil then MouseDownComponent:=NonVisualComp;
|
||||
|
||||
CompIndex:=ControlSelection.IndexOf(MouseDownComponent);
|
||||
if (Message.Keys and MK_SHIFT)>0 then begin
|
||||
// shift key (multiselection)
|
||||
if (TheMessage.Keys and MK_SHIFT)>0 then begin
|
||||
|
||||
// shift key pressed (multiselection)
|
||||
if CompIndex<0 then begin
|
||||
// not selected
|
||||
// add component to selection
|
||||
@ -415,21 +404,23 @@ Begin
|
||||
InvalidateWithParent(MouseDownComponent);
|
||||
end;
|
||||
end else begin
|
||||
|
||||
// no shift key (single selection)
|
||||
if (CompIndex<0) then begin
|
||||
// select only this component
|
||||
AControlSelection:=TControlSelection.Create;
|
||||
AControlSelection.Assign(ControlSelection);
|
||||
|
||||
// invalidate old components
|
||||
for i:=0 to ControlSelection.Count-1 do
|
||||
if ControlSelection[i].Component is TControl then
|
||||
InvalidateWithParent(TControl(ControlSelection[i].Component));
|
||||
|
||||
// clear old selection and select new component
|
||||
ControlSelection.BeginUpdate;
|
||||
ControlSelection.Clear;
|
||||
for i:=0 to AControlSelection.Count-1 do
|
||||
if AControlSelection[i].Component is TControl then
|
||||
TControl(AControlSelection[i].Component).Invalidate;
|
||||
ControlSelection.Add(MouseDownComponent);
|
||||
ControlSelection.EndUpdate;
|
||||
InvalidateWithParent(MouseDownComponent);
|
||||
AControlSelection.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
// mouse down on grabber -> begin sizing
|
||||
@ -439,6 +430,9 @@ Begin
|
||||
end else begin
|
||||
// add component mode -> handled in mousemove and mouseup
|
||||
end;
|
||||
end else begin
|
||||
// not left button
|
||||
ControlSelection.ActiveGrabber:=nil;
|
||||
end;
|
||||
|
||||
{$IFDEF VerboseDesigner}
|
||||
@ -446,16 +440,17 @@ Begin
|
||||
{$ENDIF}
|
||||
End;
|
||||
|
||||
procedure TDesigner.MouseLeftUpOnControl(Sender : TControl; Message:TLMMouse);
|
||||
procedure TDesigner.MouseLeftUpOnControl(Sender : TControl;
|
||||
TheMessage:TLMMouse);
|
||||
var
|
||||
ParentCI, NewCI : TComponentInterface;
|
||||
NewLeft, NewTop, NewWidth, NewHeight,
|
||||
MouseX, MouseY : Integer;
|
||||
Shift : TShiftState;
|
||||
SenderParentForm:TCustomForm;
|
||||
RubberBandWasActive:boolean;
|
||||
SenderOrigin:TPoint;
|
||||
ParentCI, NewCI: TComponentInterface;
|
||||
NewLeft, NewTop, NewWidth, NewHeight, MoveX, MoveY: Integer;
|
||||
Shift: TShiftState;
|
||||
SenderParentForm: TCustomForm;
|
||||
RubberBandWasActive: boolean;
|
||||
SenderClientOrigin, ParentClientOrigin: TPoint;
|
||||
SelectedCompClass: TRegisteredComponent;
|
||||
NewParent: TWinControl;
|
||||
Begin
|
||||
FHintTimer.Enabled := False;
|
||||
|
||||
@ -466,36 +461,35 @@ Begin
|
||||
RubberBandWasActive:=ControlSelection.RubberBandActive;
|
||||
|
||||
Shift := [];
|
||||
if (Message.keys and MK_Shift) = MK_Shift then
|
||||
if (TheMessage.keys and MK_Shift) = MK_Shift then
|
||||
Shift := [ssShift];
|
||||
if (Message.keys and MK_Control) = MK_Control then
|
||||
if (TheMessage.keys and MK_Control) = MK_Control then
|
||||
Shift := Shift +[ssCTRL];
|
||||
|
||||
SenderOrigin:=GetFormRelativeControlTopLeft(Sender);
|
||||
MouseX:=Message.Pos.X+SenderOrigin.X;
|
||||
MouseY:=Message.Pos.Y+SenderOrigin.Y;
|
||||
MouseUpPos := Point(MouseX,MouseY);
|
||||
dec(MouseX,MouseDownPos.X);
|
||||
dec(MouseY,MouseDownPos.Y);
|
||||
SenderClientOrigin:=GetParentFormRelativeClientOrigin(Sender);
|
||||
MouseUpPos := Point(TheMessage.Pos.X+SenderClientOrigin.X,
|
||||
TheMessage.Pos.Y+SenderClientOrigin.Y);
|
||||
MoveX:=MouseUpPos.X-MouseDownPos.X;
|
||||
MoveY:=MouseUpPos.Y-MouseDownPos.Y;
|
||||
|
||||
{$IFDEF VerboseDesigner}
|
||||
writeln('************************************************************');
|
||||
write('MouseLeftUpOnControl');
|
||||
write(' ',Sender.Name,':',Sender.ClassName,' Origin=',SenderOrigin.X,',',SenderOrigin.Y);
|
||||
write(' Msg=',Message.Pos.X,',',Message.Pos.Y);
|
||||
write(' Mouse=',MouseX,',',MouseY);
|
||||
write(' ',Sender.Name,':',Sender.ClassName,
|
||||
' ClientOrigin=',SenderClientOrigin.X,',',SenderClientOrigin.Y);
|
||||
write(' Msg=',TheMessage.Pos.X,',',TheMessage.Pos.Y);
|
||||
write(' Move=',MoveX,',',MoveY);
|
||||
writeln('');
|
||||
{$ENDIF}
|
||||
|
||||
SelectedCompClass:=nil;
|
||||
if Assigned(FOnGetSelectedComponentClass) then
|
||||
FOnGetSelectedComponentClass(Self,SelectedCompClass)
|
||||
else
|
||||
SelectedCompClass:=nil;
|
||||
FOnGetSelectedComponentClass(Self,SelectedCompClass);
|
||||
|
||||
if (Message.Keys and MK_LButton) > 0 then begin
|
||||
// left mouse button
|
||||
if (TheMessage.Keys and MK_LButton) > 0 then begin
|
||||
// left mouse button up
|
||||
if SelectedCompClass = nil then begin
|
||||
// selection mode
|
||||
// selection mode (+ moving and resizing)
|
||||
ControlSelection.BeginUpdate;
|
||||
if not FHasSized then begin
|
||||
if RubberBandWasActive then begin
|
||||
@ -514,53 +508,54 @@ Begin
|
||||
ControlSelection.Add(Sender);
|
||||
end;
|
||||
end;
|
||||
ControlSelection.EndUpdate;
|
||||
SenderParentForm.Invalidate;
|
||||
end;
|
||||
end else begin
|
||||
// add a new control
|
||||
ControlSelection.EndUpdate;
|
||||
end else begin
|
||||
// add a new component
|
||||
ControlSelection.RubberbandActive:=false;
|
||||
ControlSelection.BeginUpdate;
|
||||
if Assigned(FOnSetDesigning) then FOnSetDesigning(Self,FCustomForm,False);
|
||||
ParentCI:=TComponentInterface(FFormEditor.FindComponent(Sender));
|
||||
if (Sender is TWinControl)
|
||||
and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then begin
|
||||
ParentCI:=TComponentInterface(
|
||||
FFormEditor.FindComponent(TWinControl(Sender).Parent));
|
||||
|
||||
// find a parent for the new component
|
||||
NewParent:=TWinControl(Sender);
|
||||
while (NewParent<>nil)
|
||||
and ((not (csAcceptsControls in NewParent.ControlStyle))
|
||||
or ((NewParent.Owner<>Form) and (NewParent<>Form)))
|
||||
do begin
|
||||
NewParent:=NewParent.Parent;
|
||||
end;
|
||||
ParentCI:=TComponentInterface(FFormEditor.FindComponent(NewParent));
|
||||
if Assigned(ParentCI) then begin
|
||||
NewLeft:=Min(MouseDownPos.X,MouseUpPos.X)-SenderOrigin.X;
|
||||
NewWidth:=Abs(MouseUpPos.X-MouseDownPos.X)-SenderOrigin.Y;
|
||||
NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y);
|
||||
ParentClientOrigin:=GetParentFormRelativeClientOrigin(NewParent);
|
||||
NewLeft:=Min(MouseDownPos.X,MouseUpPos.X)-ParentClientOrigin.X;
|
||||
NewWidth:=Abs(MouseUpPos.X-MouseDownPos.X);
|
||||
NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y)-ParentClientOrigin.Y;
|
||||
NewHeight:=Abs(MouseUpPos.Y-MouseDownPos.Y);
|
||||
if Abs(NewWidth+NewHeight)<7 then begin
|
||||
// this very small component is probably only a wag, take default size
|
||||
NewWidth:=0;
|
||||
NewHeight:=0;
|
||||
end;
|
||||
|
||||
NewCI := TComponentInterface(FFormEditor.CreateComponent(
|
||||
ParentCI,SelectedCompClass.ComponentClass
|
||||
,NewLeft,NewTop,NewWidth,NewHeight));
|
||||
NewCI.SetPropByName('Visible',True);
|
||||
NewCI.SetPropByName('Designing',True);
|
||||
if NewCI.Control is TControl then
|
||||
TControl(NewCI.Control).Visible:=true;
|
||||
if Assigned(FOnSetDesigning) then
|
||||
FOnSetDesigning(Self,NewCI.Control,True);
|
||||
if Assigned(FOnComponentListChanged) then
|
||||
FOnComponentListChanged(Self);
|
||||
if Assigned(FOnAddComponent) then
|
||||
FOnAddComponent(Self,NewCI.Control,SelectedCompClass);
|
||||
|
||||
SelectOnlyThisComponent(TComponent(NewCI.Control));
|
||||
Writeln('Calling ControlClick with nil from MouseLeftUpOnControl');
|
||||
if not (ssShift in Shift) then
|
||||
if Assigned(FOnUnselectComponentClass) then
|
||||
// this resets the component toolbar to the mouse. (= selection tool)
|
||||
FOnUnselectComponentClass(Self);
|
||||
if Assigned(FOnSetDesigning) then
|
||||
FOnSetDesigning(Self,FCustomForm,True);
|
||||
Form.Invalidate;
|
||||
{$IFDEF VerboseDesigner}
|
||||
writeln('NEW COMPONENT ADDED: ',Form.ComponentCount,' ',NewCI.Control.Owner.Name);
|
||||
writeln('NEW COMPONENT ADDED: Form.ComponentCount=',Form.ComponentCount,
|
||||
' NewCI.Control.Owner.Name=',NewCI.Control.Owner.Name);
|
||||
{$ENDIF}
|
||||
end;
|
||||
ControlSelection.EndUpdate;
|
||||
@ -576,124 +571,108 @@ Begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
Procedure TDesigner.MouseMoveOnControl(Sender : TControl; var Message : TLMMouse);
|
||||
Procedure TDesigner.MouseMoveOnControl(Sender: TControl;
|
||||
var TheMessage: TLMMouse);
|
||||
var
|
||||
Shift : TShiftState;
|
||||
SenderOrigin:TPoint;
|
||||
SenderClientOrigin:TPoint;
|
||||
SenderParentForm:TCustomForm;
|
||||
MouseX, MouseY :integer;
|
||||
UpdateLastMove : Boolean;
|
||||
OldMouseMovePos: TPoint;
|
||||
begin
|
||||
try
|
||||
UpdateLastMove := True;
|
||||
if FShowHints then begin
|
||||
FHintTimer.Enabled := False;
|
||||
if FShowHints then begin
|
||||
FHintTimer.Enabled := False;
|
||||
|
||||
{ don't want it enabled when a mouse button is pressed. }
|
||||
FHintTimer.Enabled :=
|
||||
(Message.keys or (MK_LButton and MK_RButton and MK_MButton) = 0);
|
||||
if FHintWindow.Visible then
|
||||
FHintWindow.Visible := False;
|
||||
end;
|
||||
{ don't want it enabled when a mouse button is pressed. }
|
||||
FHintTimer.Enabled :=
|
||||
(TheMessage.keys or (MK_LButton and MK_RButton and MK_MButton) = 0);
|
||||
if FHintWindow.Visible then
|
||||
FHintWindow.Visible := False;
|
||||
end;
|
||||
|
||||
if MouseDownComponent=nil then exit;
|
||||
if MouseDownComponent=nil then exit;
|
||||
SenderParentForm:=GetParentForm(Sender);
|
||||
if SenderParentForm=nil then exit;
|
||||
|
||||
OldMouseMovePos:=LastMouseMovePos;
|
||||
SenderClientOrigin:=GetParentFormRelativeClientOrigin(Sender);
|
||||
LastMouseMovePos:=Point(TheMessage.Pos.X+SenderClientOrigin.X,
|
||||
TheMessage.Pos.Y+SenderClientOrigin.Y);
|
||||
|
||||
SenderParentForm:=GetParentForm(Sender);
|
||||
if SenderParentForm=nil then exit;
|
||||
|
||||
|
||||
SenderOrigin:=GetFormRelativeControlTopLeft(Sender);
|
||||
|
||||
MouseX:=Message.Pos.X+SenderOrigin.X;
|
||||
MouseY:=Message.Pos.Y+SenderOrigin.Y;
|
||||
if (Mouse.CursorPos.X < SenderParentForm.Left)
|
||||
or (Mouse.CursorPos.Y < SenderParentForm.Top)
|
||||
or (Mouse.CursorPos.X > (SenderParentForm.Left+SenderParentForm.Width
|
||||
+(TForm(Senderparentform).borderwidth)))
|
||||
or (Mouse.CursorPos.Y > (SenderParentForm.Top+SenderParentForm.Height+(22)))
|
||||
then begin
|
||||
UpdateLastMove := False;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
//debugging commented out
|
||||
{ if (Message.keys and MK_LButton) = MK_LButton then begin
|
||||
Write('MouseMoveOnControl'
|
||||
,' ',Sender.ClassName
|
||||
,' ',GetCaptureControl<>nil
|
||||
,' ',Sender.Left,',',Sender.Top
|
||||
,' Origin=',SenderOrigin.X,',',SenderOrigin.Y
|
||||
,' Msg=',Message.Pos.x,',',Message.Pos.Y
|
||||
,' Mouse=',MouseX,',',MouseY
|
||||
);
|
||||
write(' ',MouseDownComponent is TWinControl);
|
||||
if (MouseDownComponent is TControl) then begin
|
||||
write(' ',csCaptureMouse in TWinControl(MouseDownComponent).ControlStyle);
|
||||
end;
|
||||
writeln();
|
||||
{ if (Message.keys and MK_LButton) = MK_LButton then begin
|
||||
Write('MouseMoveOnControl'
|
||||
,' ',Sender.ClassName
|
||||
,' ',GetCaptureControl<>nil
|
||||
,' ',Sender.Left,',',Sender.Top
|
||||
,' Origin=',SenderOrigin.X,',',SenderOrigin.Y
|
||||
,' Msg=',Message.Pos.x,',',Message.Pos.Y
|
||||
,' Mouse=',MouseX,',',MouseY
|
||||
);
|
||||
write(' ',MouseDownComponent is TWinControl);
|
||||
if (MouseDownComponent is TControl) then begin
|
||||
write(' ',csCaptureMouse in TWinControl(MouseDownComponent).ControlStyle);
|
||||
end;
|
||||
}
|
||||
Shift := [];
|
||||
if (TLMMouse(Message).keys and MK_Shift) = MK_Shift then
|
||||
Shift := [ssShift];
|
||||
if (TLMMouse(Message).keys and MK_Control) = MK_Control then
|
||||
Shift := Shift + [ssCTRL];
|
||||
writeln();
|
||||
end;
|
||||
}
|
||||
Shift := [];
|
||||
if (TheMessage.keys and MK_Shift) = MK_Shift then
|
||||
Shift := [ssShift];
|
||||
if (TheMessage.keys and MK_Control) = MK_Control then
|
||||
Shift := Shift + [ssCTRL];
|
||||
|
||||
if (Message.keys and MK_LButton) = MK_LButton then begin
|
||||
if ControlSelection.ActiveGrabber<>nil then
|
||||
begin
|
||||
FHasSized:=true;
|
||||
ControlSelection.SizeSelection(MouseX-LastMouseMovePos.X,
|
||||
MouseY-LastMouseMovePos.Y);
|
||||
//commented out by sxm 2001-11-21
|
||||
// if Assigned(FOnPropertiesChanged) then
|
||||
// FOnPropertiesChanged(Self);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (not (MouseDownComponent is TCustomForm))
|
||||
and (ControlSelection.Count>=1)
|
||||
and not (ControlSelection[0].Component is TCustomForm) then
|
||||
begin
|
||||
// move selection
|
||||
FHasSized:=true;
|
||||
//TODO:create a rubberband looking control to move instead of the components
|
||||
//that will speed up to updates.
|
||||
MoveSelection(MouseX-LastMouseMovePos.X,MouseY-LastMouseMovePos.Y);
|
||||
//commented out by sxm 2001-11-21
|
||||
// if Assigned(FOnPropertiesChanged) then
|
||||
// FOnPropertiesChanged(Self);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// rubberband selection/creation
|
||||
ControlSelection.RubberBandBounds:=Rect(MouseDownPos.X,MouseDownPos.Y,
|
||||
MouseX,MouseY);
|
||||
ControlSelection.RubberBandActive:=true;
|
||||
SenderParentForm.Invalidate;
|
||||
end;
|
||||
if (TheMessage.keys and MK_LButton) = MK_LButton then begin
|
||||
// left button pressed
|
||||
if ControlSelection.ActiveGrabber<>nil then begin
|
||||
// grabber moving -> size selection
|
||||
if not FHasSized then begin
|
||||
ControlSelection.SaveBounds;
|
||||
FHasSized:=true;
|
||||
end;
|
||||
ControlSelection.SizeSelection(
|
||||
LastMouseMovePos.X-OldMouseMovePos.X,
|
||||
LastMouseMovePos.Y-OldMouseMovePos.Y);
|
||||
if Assigned(OnModified) then OnModified(Self);
|
||||
end else begin
|
||||
ControlSelection.ActiveGrabber:=nil;
|
||||
if (not ComponentIsTopLvl(MouseDownComponent))
|
||||
and (ControlSelection.Count>=1)
|
||||
and not (ControlSelection[0].Component is TCustomForm) then
|
||||
begin
|
||||
// move selection
|
||||
if not FHasSized then begin
|
||||
ControlSelection.SaveBounds;
|
||||
FHasSized:=true;
|
||||
end;
|
||||
ControlSelection.MoveSelectionWithSnapping(
|
||||
LastMouseMovePos.X-MouseDownPos.X,LastMouseMovePos.Y-MouseDownPos.Y);
|
||||
if Assigned(OnModified) then OnModified(Self);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// rubberband sizing
|
||||
ControlSelection.RubberBandBounds:=Rect(MouseDownPos.X,MouseDownPos.Y,
|
||||
LastMouseMovePos.X,
|
||||
LastMouseMovePos.Y);
|
||||
ControlSelection.RubberBandActive:=true;
|
||||
SenderParentForm.Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
SenderOrigin:=GetFormRelativeControlTopLeft(Sender);
|
||||
if UpdateLastMove then
|
||||
LastMouseMovePos:=Point(MouseX,MouseY);
|
||||
end else begin
|
||||
ControlSelection.ActiveGrabber:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDesigner.MouseRightUpOnControl(Sender : TControl; Message:TLMMouse);
|
||||
procedure TDesigner.MouseRightUpOnControl(Sender : TControl; TheMessage:TLMMouse);
|
||||
var
|
||||
MouseX, MouseY : Integer;
|
||||
SenderOrigin: TPoint;
|
||||
begin
|
||||
FHintTimer.Enabled := False;
|
||||
|
||||
SenderOrigin:=GetFormRelativeControlTopLeft(Sender);
|
||||
MouseX:=Message.Pos.X+SenderOrigin.X;
|
||||
MouseY:=Message.Pos.Y+SenderOrigin.Y;
|
||||
SenderOrigin:=GetParentFormRelativeTopLeft(Sender);
|
||||
MouseX:=TheMessage.Pos.X+SenderOrigin.X;
|
||||
MouseY:=TheMessage.Pos.Y+SenderOrigin.Y;
|
||||
BuildPopupMenu;
|
||||
FPopupMenu.Popup(MouseX,MouseY);
|
||||
end;
|
||||
@ -705,25 +684,26 @@ end;
|
||||
Handles the keydown messages. DEL deletes the selected controls, CTRL-ARROR
|
||||
moves the selection up one, SHIFT-ARROW resizes, etc.
|
||||
}
|
||||
Procedure TDesigner.KeyDown(Sender : TControl; Message:TLMKEY);
|
||||
Procedure TDesigner.KeyDown(Sender : TControl; TheMessage:TLMKEY);
|
||||
var
|
||||
I : Integer;
|
||||
Shift : TShiftState;
|
||||
Begin
|
||||
{$IFDEF VerboseDesigner}
|
||||
Writeln('TDesigner.KEYDOWN');
|
||||
with MEssage do
|
||||
with TheMessage do
|
||||
Begin
|
||||
Writeln('CHARCODE = '+inttostr(charcode));
|
||||
Writeln('KEYDATA = '+inttostr(KeyData));
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
Shift := KeyDataToShiftState(Message.KeyData);
|
||||
Shift := KeyDataToShiftState(TheMessage.KeyData);
|
||||
|
||||
if (Message.CharCode = 46) then //DEL KEY
|
||||
if (TheMessage.CharCode = 46) then //DEL KEY
|
||||
begin
|
||||
if (ControlSelection.Count = 1) and (ControlSelection.Items[0].Component = FCustomForm) then
|
||||
if (ControlSelection.Count = 1)
|
||||
and (ControlSelection.Items[0].Component = FCustomForm) then
|
||||
Exit;
|
||||
ControlSelection.BeginUpdate;
|
||||
for I := ControlSelection.Count-1 downto 0 do Begin
|
||||
@ -734,14 +714,14 @@ Begin
|
||||
ControlSelection.EndUpdate;
|
||||
end
|
||||
else
|
||||
if Message.CharCode = 38 then //UP ARROW
|
||||
if TheMessage.CharCode = 38 then //UP ARROW
|
||||
Begin
|
||||
if (ssCtrl in Shift) then
|
||||
NudgeControl(0,-1)
|
||||
else if (ssShift in Shift) then
|
||||
NudgeSize(0,-1);
|
||||
end
|
||||
else if Message.CharCode = 40 then //DOWN ARROW
|
||||
else if TheMessage.CharCode = 40 then //DOWN ARROW
|
||||
Begin
|
||||
if (ssCtrl in Shift) then
|
||||
NudgeControl(0,1)
|
||||
@ -749,7 +729,7 @@ Begin
|
||||
NudgeSize(0,1);
|
||||
end
|
||||
else
|
||||
if Message.CharCode = 39 then //RIGHT ARROW
|
||||
if TheMessage.CharCode = 39 then //RIGHT ARROW
|
||||
Begin
|
||||
if (ssCtrl in Shift) then
|
||||
NudgeControl(1,0)
|
||||
@ -757,7 +737,7 @@ Begin
|
||||
NudgeSize(1,0);
|
||||
end
|
||||
else
|
||||
if Message.CharCode = 37 then //LEFT ARROW
|
||||
if TheMessage.CharCode = 37 then //LEFT ARROW
|
||||
Begin
|
||||
if (ssCtrl in Shift) then
|
||||
NudgeControl(-1,0)
|
||||
@ -768,11 +748,11 @@ end;
|
||||
|
||||
|
||||
{-----------------------------------------K E Y U P --------------------------------}
|
||||
Procedure TDesigner.KeyUp(Sender : TControl; Message:TLMKEY);
|
||||
Procedure TDesigner.KeyUp(Sender : TControl; TheMessage:TLMKEY);
|
||||
Begin
|
||||
{$IFDEF VerboseDesigner}
|
||||
Writeln('KEYUp');
|
||||
with MEssage do
|
||||
with TheMessage do
|
||||
Begin
|
||||
Writeln('CHARCODE = '+inttostr(charcode));
|
||||
Writeln('KEYDATA = '+inttostr(KeyData));
|
||||
@ -780,22 +760,22 @@ Begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TDesigner.IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean;
|
||||
function TDesigner.IsDesignMsg(Sender: TControl; var TheMessage: TLMessage): Boolean;
|
||||
Begin
|
||||
Result := false;
|
||||
if csDesigning in Sender.ComponentState then begin
|
||||
Result:=true;
|
||||
case Message.Msg of
|
||||
LM_PAINT: Result:=PaintControl(Sender,TLMPaint(Message));
|
||||
LM_KEYDOWN: KeyDown(Sender,TLMKey(Message));
|
||||
LM_KEYUP: KeyUP(Sender,TLMKey(Message));
|
||||
case TheMessage.Msg of
|
||||
LM_PAINT: Result:=PaintControl(Sender,TLMPaint(TheMessage));
|
||||
LM_KEYDOWN: KeyDown(Sender,TLMKey(TheMessage));
|
||||
LM_KEYUP: KeyUP(Sender,TLMKey(TheMessage));
|
||||
LM_LBUTTONDOWN,
|
||||
LM_RBUTTONDOWN: MouseDownOnControl(Sender,TLMMouse(Message));
|
||||
LM_LBUTTONUP: MouseLeftUpOnControl(Sender,TLMMouse(Message));
|
||||
LM_RBUTTONUP: MouseRightUpOnControl(sender,TLMMouse(Message));
|
||||
LM_MOUSEMOVE: MouseMoveOnControl(Sender, TLMMouse(Message));
|
||||
LM_SIZE: Result:=SizeControl(Sender,TLMSize(Message));
|
||||
LM_MOVE: Result:=MoveControl(Sender,TLMMove(Message));
|
||||
LM_RBUTTONDOWN: MouseDownOnControl(Sender,TLMMouse(TheMessage));
|
||||
LM_LBUTTONUP: MouseLeftUpOnControl(Sender,TLMMouse(TheMessage));
|
||||
LM_RBUTTONUP: MouseRightUpOnControl(sender,TLMMouse(TheMessage));
|
||||
LM_MOUSEMOVE: MouseMoveOnControl(Sender, TLMMouse(TheMessage));
|
||||
LM_SIZE: Result:=SizeControl(Sender,TLMSize(TheMessage));
|
||||
LM_MOVE: Result:=MoveControl(Sender,TLMMove(TheMessage));
|
||||
LM_ACTIVATE : OnFormActivated;
|
||||
// CM_MOUSELEAVE: Writeln('MOUSELEAVE!!!!!!!!!!!!');//Result:=MoveControl(Sender,TLMMove(Message));
|
||||
else
|
||||
@ -831,7 +811,7 @@ procedure TDesigner.PaintGrid;
|
||||
var
|
||||
x,y, StepX, StepY : integer;
|
||||
begin
|
||||
if not DisplayGrid then exit;
|
||||
if not ShowGrid then exit;
|
||||
StepX:=GridSizeX;
|
||||
StepY:=GridSizeY;
|
||||
with FCustomForm.Canvas do begin
|
||||
@ -866,9 +846,9 @@ Begin
|
||||
OnRenameComponent(Self,AComponent,NewName);
|
||||
end;
|
||||
|
||||
function TDesigner.GetDisplayGrid: boolean;
|
||||
function TDesigner.GetShowGrid: boolean;
|
||||
begin
|
||||
Result:=EnvironmentOptions.DisplayGrid;
|
||||
Result:=EnvironmentOptions.ShowGrid;
|
||||
end;
|
||||
|
||||
function TDesigner.GetGridSizeX: integer;
|
||||
@ -893,10 +873,10 @@ begin
|
||||
Result:=EnvironmentOptions.SnapToGrid;
|
||||
end;
|
||||
|
||||
procedure TDesigner.SetDisplayGrid(const AValue: boolean);
|
||||
procedure TDesigner.SetShowGrid(const AValue: boolean);
|
||||
begin
|
||||
if DisplayGrid=AValue then exit;
|
||||
EnvironmentOptions.DisplayGrid:=AValue;
|
||||
if ShowGrid=AValue then exit;
|
||||
EnvironmentOptions.ShowGrid:=AValue;
|
||||
Form.Invalidate;
|
||||
end;
|
||||
|
||||
|
@ -37,9 +37,9 @@ uses
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Forms, Controls, Buttons, XMLCfg, ObjectInspector,
|
||||
ExtCtrls, StdCtrls, EditorOptions, LResources, LazConf, Dialogs,
|
||||
ExtToolDialog, IDEProcs, IDEOptionDefs, InputHistory;
|
||||
Classes, SysUtils, Forms, Controls, Buttons, GraphType, Graphics, XMLCfg,
|
||||
ObjectInspector, ExtCtrls, StdCtrls, EditorOptions, LResources, LazConf,
|
||||
Dialogs, ExtToolDialog, IDEProcs, IDEOptionDefs, InputHistory;
|
||||
|
||||
const
|
||||
EnvOptsVersion: integer = 101;
|
||||
@ -90,14 +90,19 @@ type
|
||||
FIDEWindowLayoutList: TIDEWindowLayoutList;
|
||||
|
||||
// form editor
|
||||
FDisplayGrid: boolean;
|
||||
FShowGrid: boolean;
|
||||
FGridColor: TColor;
|
||||
FSnapToGrid: boolean;
|
||||
FGridSizeX: integer;
|
||||
FGridSizeY: integer;
|
||||
FShowGuideLines: boolean;
|
||||
FSnapToGuideLines: boolean;
|
||||
FGuideLineColorLeftTop: TColor;
|
||||
FGuideLineColorRightBottom: TColor;
|
||||
FShowComponentCaptions: boolean;
|
||||
FShowEditorHints: boolean;
|
||||
FAutoCreateForms: boolean;
|
||||
FGridSizeX: integer;
|
||||
FGridSizeY: integer;
|
||||
|
||||
|
||||
// object inspector
|
||||
FObjectInspectorOptions: TOIOptions;
|
||||
|
||||
@ -165,14 +170,21 @@ type
|
||||
read FIDEWindowLayoutList write FIDEWindowLayoutList;
|
||||
|
||||
// form editor
|
||||
property DisplayGrid: boolean read FDisplayGrid write FDisplayGrid;
|
||||
property ShowGrid: boolean read FShowGrid write FShowGrid;
|
||||
property SnapToGrid: boolean read FSnapToGrid write FSnapToGrid;
|
||||
property GridColor: TColor read FGridColor write FGridColor;
|
||||
property GridSizeX: integer read FGridSizeX write FGridSizeX;
|
||||
property GridSizeY: integer read FGridSizeY write FGridSizeY;
|
||||
property ShowGuideLines: boolean read FShowGuideLines write FShowGuideLines;
|
||||
property SnapToGuideLines: boolean read FSnapToGuideLines write FSnapToGuideLines;
|
||||
property GuideLineColorLeftTop: TColor
|
||||
read FGuideLineColorLeftTop write FGuideLineColorLeftTop;
|
||||
property GuideLineColorRightBottom: TColor
|
||||
read FGuideLineColorRightBottom write FGuideLineColorRightBottom;
|
||||
property ShowComponentCaptions: boolean
|
||||
read FShowComponentCaptions write FShowComponentCaptions;
|
||||
property ShowEditorHints: boolean read FShowEditorHints write FShowEditorHints;
|
||||
property AutoCreateForms: boolean read FAutoCreateForms write FAutoCreateForms;
|
||||
property GridSizeX: integer read FGridSizeX write FGridSizeX;
|
||||
property GridSizeY: integer read FGridSizeY write FGridSizeY;
|
||||
|
||||
// object inspector
|
||||
property ObjectInspectorOptions: TOIOptions
|
||||
@ -274,15 +286,26 @@ type
|
||||
WindowPositionsBox: TIDEWindowSetupLayoutComponent;
|
||||
|
||||
// form editor
|
||||
DisplayGridCheckBox: TCheckBox;
|
||||
GridGroupBox: TGroupBox;
|
||||
ShowGridCheckBox: TCheckBox;
|
||||
GridColorLabel: TLabel;
|
||||
GridColorButton: TColorButton;
|
||||
SnapToGridCheckBox: TCheckBox;
|
||||
ShowComponentCaptionsCheckBox: TCheckBox;
|
||||
ShowEditorHintsCheckBox: TCheckBox;
|
||||
AutoCreateFormsCheckBox: TCheckBox;
|
||||
GridSizeXLabel: TLabel;
|
||||
GridSizeXComboBox: TComboBox;
|
||||
GridSizeYLabel: TLabel;
|
||||
GridSizeYComboBox: TComboBox;
|
||||
GuideLinesGroupBox: TGroupBox;
|
||||
ShowGuideLinesCheckBox: TCheckBox;
|
||||
SnapToGuideLinesCheckBox: TCheckBox;
|
||||
GuideLineColorLeftTopLabel: TLabel;
|
||||
GuideLineColorLeftTopButton: TColorButton;
|
||||
GuideLineColorRightBottomLabel: TLabel;
|
||||
GuideLineColorRightBottomButton: TColorButton;
|
||||
FormEditMiscGroupBox: TGroupBox;
|
||||
ShowComponentCaptionsCheckBox: TCheckBox;
|
||||
ShowEditorHintsCheckBox: TCheckBox;
|
||||
AutoCreateFormsCheckBox: TCheckBox;
|
||||
|
||||
// object inspector
|
||||
ObjectInspectorGroupBox: TGroupBox;
|
||||
@ -451,13 +474,18 @@ begin
|
||||
InitLayoutList;
|
||||
|
||||
// form editor
|
||||
FDisplayGrid:=true;
|
||||
FShowGrid:=true;
|
||||
FGridColor:=clBlack;
|
||||
FSnapToGrid:=true;
|
||||
FGridSizeX:=8;
|
||||
FGridSizeY:=8;
|
||||
FShowGuideLines:=true;
|
||||
FSnapToGuideLines:=true;
|
||||
FGuideLineColorLeftTop:=clBlue;
|
||||
FGuideLineColorRightBottom:=clGreen;
|
||||
FShowComponentCaptions:=false;
|
||||
FShowEditorHints:=false;
|
||||
FAutoCreateForms:=true;
|
||||
FGridSizeX:=8;
|
||||
FGridSizeY:=8;
|
||||
|
||||
// object inspector
|
||||
FObjectInspectorOptions:=TOIOptions.Create;
|
||||
@ -610,20 +638,32 @@ begin
|
||||
'EnvironmentOptions/Desktop/');
|
||||
|
||||
// form editor
|
||||
FDisplayGrid:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/DisplayGrid',FDisplayGrid);
|
||||
FShowGrid:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowGrid',FShowGrid);
|
||||
FGridColor:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GridColor',FGridColor);
|
||||
FSnapToGrid:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/SnapToGrid',FSnapToGrid);
|
||||
FGridSizeX:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeX',FGridSizeX);
|
||||
FGridSizeY:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeY',FGridSizeY);
|
||||
FShowGuideLines:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowGuideLines',FShowGuideLines);
|
||||
FSnapToGuideLines:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/SnapToGuideLines',FSnapToGuideLines);
|
||||
FGuideLineColorLeftTop:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GuideLineColorLeftTop',
|
||||
FGuideLineColorLeftTop);
|
||||
FGuideLineColorRightBottom:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GuideLineColorRightBottom',
|
||||
FGuideLineColorRightBottom);
|
||||
FShowComponentCaptions:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowComponentCaptions',FShowComponentCaptions);
|
||||
FShowEditorHints:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowEditorHints',FShowEditorHints);
|
||||
FAutoCreateForms:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/AutoCreateForms',FAutoCreateForms);
|
||||
FGridSizeX:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeX',FGridSizeX);
|
||||
FGridSizeY:=XMLConfig.GetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeY',FGridSizeY);
|
||||
|
||||
if not OnlyDesktop then begin
|
||||
// files
|
||||
@ -778,16 +818,32 @@ begin
|
||||
'EnvironmentOptions/Desktop/');
|
||||
|
||||
// form editor
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/DisplayGrid',FDisplayGrid);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/SnapToGrid',FSnapToGrid);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/ShowComponentCaptions'
|
||||
,FShowComponentCaptions);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/ShowEditorHints'
|
||||
,FShowEditorHints);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/AutoCreateForms'
|
||||
,FAutoCreateForms);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/GridSizeX',FGridSizeX);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/GridSizeY',FGridSizeY);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowGrid',FShowGrid);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/GridColor',FGridColor);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/SnapToGrid',FSnapToGrid);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeX',FGridSizeX);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/GridSizeY',FGridSizeY);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowGuideLines',FShowGuideLines);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/SnapToGuideLines',FSnapToGuideLines);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/GuideLineColorLeftTop',
|
||||
FGuideLineColorLeftTop);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/GuideLineColorRightBottom',
|
||||
FGuideLineColorRightBottom);
|
||||
XMLConfig.SetValue('EnvironmentOptions/FormEditor/ShowComponentCaptions',
|
||||
FShowComponentCaptions);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/ShowEditorHints',FShowEditorHints);
|
||||
XMLConfig.SetValue(
|
||||
'EnvironmentOptions/FormEditor/AutoCreateForms',FAutoCreateForms);
|
||||
|
||||
if not OnlyDesktop then begin
|
||||
// files
|
||||
@ -1702,129 +1758,273 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptionsDialog.SetupFormEditorPage(Page: integer);
|
||||
|
||||
procedure SetupGridGroupBox;
|
||||
begin
|
||||
ShowGridCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowGridCheckBox do begin
|
||||
Name:='ShowGridCheckBox';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=6;
|
||||
Top:=2;
|
||||
Width:=200;
|
||||
Caption:='Show grid';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridColorButton:=TColorButton.Create(Self);
|
||||
with GridColorButton do begin
|
||||
Name:='GridColorButton';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=ShowGridCheckBox.Left;
|
||||
Top:=ShowGridCheckBox.Top+ShowGridCheckBox.Height+5;
|
||||
Width:=50;
|
||||
Height:=25;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridColorLabel:=TLabel.Create(Self);
|
||||
with GridColorLabel do begin
|
||||
Name:='GridColorLabel';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=GridColorButton.Left+GridColorButton.Width+5;
|
||||
Top:=GridColorButton.Top+2;
|
||||
Width:=80;
|
||||
Caption:='Grid color';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
SnapToGridCheckBox:=TCheckBox.Create(Self);
|
||||
with SnapToGridCheckBox do begin
|
||||
Name:='SnapToGridCheckBox';
|
||||
Parent:=GridGroupBox;
|
||||
Top:=GridColorLabel.Top+GridColorLabel.Height+10;
|
||||
Left:=ShowGridCheckBox.Left;
|
||||
Width:=ShowGridCheckBox.Width;
|
||||
Height:=ShowGridCheckBox.Height;
|
||||
Caption:='Snap to grid';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeXLabel:=TLabel.Create(Self);
|
||||
with GridSizeXLabel do begin
|
||||
Name:='GridSizeXLabel';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=ShowGridCheckBox.Left;
|
||||
Top:=SnapToGridCheckBox.Top+SnapToGridCheckBox.Height+5;
|
||||
Width:=80;
|
||||
Caption:='Grid size X';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeXComboBox:=TComboBox.Create(Self);
|
||||
with GridSizeXComboBox do begin
|
||||
Name:='GridSizeXComboBox';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=GridSizeXLabel.Left+GridSizeXLabel.Width+5;
|
||||
Top:=GridSizeXLabel.Top-2;
|
||||
Width:=60;
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add('2');
|
||||
Add('5');
|
||||
Add('8');
|
||||
Add('10');
|
||||
Add('12');
|
||||
Add('15');
|
||||
Add('20');
|
||||
Add('25');
|
||||
Add('30');
|
||||
EndUpdate;
|
||||
end;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeYLabel:=TLabel.Create(Self);
|
||||
with GridSizeYLabel do begin
|
||||
Name:='GridSizeYLabel';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=GridSizeXLabel.Left;
|
||||
Top:=GridSizeXLabel.Top+GridSizeXLabel.Height+5;
|
||||
Width:=GridSizeXLabel.Width;
|
||||
Caption:='Grid size Y';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeYComboBox:=TComboBox.Create(Self);
|
||||
with GridSizeYComboBox do begin
|
||||
Name:='GridSizeYComboBox';
|
||||
Parent:=GridGroupBox;
|
||||
Left:=GridSizeYLabel.Left+GridSizeYLabel.Width+5;
|
||||
Top:=GridSizeYLabel.Top-2;
|
||||
Width:=GridSizeXComboBox.Width;
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add('2');
|
||||
Add('5');
|
||||
Add('8');
|
||||
Add('10');
|
||||
Add('12');
|
||||
Add('15');
|
||||
Add('20');
|
||||
Add('25');
|
||||
Add('30');
|
||||
EndUpdate;
|
||||
end;
|
||||
Visible:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetupGuideLinesGroupBox;
|
||||
begin
|
||||
ShowGuideLinesCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowGuideLinesCheckBox do begin
|
||||
Name:='ShowGuideLinesCheckBox';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=5;
|
||||
Top:=5;
|
||||
Width:=Parent.ClientWidth-2*Left;
|
||||
Caption:='Show Guide Lines';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
SnapToGuideLinesCheckBox:=TCheckBox.Create(Self);
|
||||
with SnapToGuideLinesCheckBox do begin
|
||||
Name:='SnapToGuideLinesCheckBox';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=ShowGuideLinesCheckBox.Left;
|
||||
Top:=ShowGuideLinesCheckBox.Top+ShowGuideLinesCheckBox.Height+5;
|
||||
Width:=ShowGuideLinesCheckBox.Width;
|
||||
Caption:='Snap to Guide Lines';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GuideLineColorLeftTopButton:=TColorButton.Create(Self);
|
||||
with GuideLineColorLeftTopButton do begin
|
||||
Name:='GuideLineColorLeftTopButton';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=SnapToGuideLinesCheckBox.Left;
|
||||
Top:=SnapToGuideLinesCheckBox.Top+SnapToGuideLinesCheckBox.Height+5;
|
||||
Width:=50;
|
||||
Height:=25;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GuideLineColorLeftTopLabel:=TLabel.Create(Self);
|
||||
with GuideLineColorLeftTopLabel do begin
|
||||
Name:='GuideLineColorLeftTopLabel';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=GuideLineColorLeftTopButton.Left+GuideLineColorLeftTopButton.Width+5;
|
||||
Top:=GuideLineColorLeftTopButton.Top+2;
|
||||
Width:=150;
|
||||
Caption:='color for left, top';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GuideLineColorRightBottomButton:=TColorButton.Create(Self);
|
||||
with GuideLineColorRightBottomButton do begin
|
||||
Name:='GuideLineColorRightBottomButton';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=GuideLineColorLeftTopButton.Left;
|
||||
Top:=GuideLineColorLeftTopButton.Top
|
||||
+GuideLineColorLeftTopButton.Height+5;
|
||||
Width:=50;
|
||||
Height:=25;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GuideLineColorRightBottomLabel:=TLabel.Create(Self);
|
||||
with GuideLineColorRightBottomLabel do begin
|
||||
Name:='GuideLineColorRightBottomLabel';
|
||||
Parent:=GuideLinesGroupBox;
|
||||
Left:=GuideLineColorLeftTopLabel.Left;
|
||||
Top:=GuideLineColorRightBottomButton.Top+2;
|
||||
Width:=GuideLineColorLeftTopLabel.Width;
|
||||
Caption:='color for right, bottom';
|
||||
Visible:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetupMiscGroupBox;
|
||||
begin
|
||||
ShowComponentCaptionsCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowComponentCaptionsCheckBox do begin
|
||||
Name:='ShowComponentCaptionsCheckBox';
|
||||
Parent:=FormEditMiscGroupBox;
|
||||
Top:=5;
|
||||
Left:=5;
|
||||
Width:=Parent.ClientWidth-2*Left;
|
||||
Caption:='Show component captions';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
ShowEditorHintsCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowEditorHintsCheckBox do begin
|
||||
Name:='ShowEditorHintsCheckBox';
|
||||
Parent:=FormEditMiscGroupBox;
|
||||
Top:=ShowComponentCaptionsCheckBox.Top
|
||||
+ShowComponentCaptionsCheckBox.Height+5;
|
||||
Left:=ShowComponentCaptionsCheckBox.Left;
|
||||
Width:=ShowComponentCaptionsCheckBox.Width;
|
||||
Caption:='Show editor hints';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
AutoCreateFormsCheckBox:=TCheckBox.Create(Self);
|
||||
with AutoCreateFormsCheckBox do begin
|
||||
Name:='AutoCreateFormsCheckBox';
|
||||
Parent:=FormEditMiscGroupBox;
|
||||
Top:=ShowEditorHintsCheckBox.Top+ShowEditorHintsCheckBox.Height+5;
|
||||
Left:=ShowEditorHintsCheckBox.Left;
|
||||
Width:=ShowEditorHintsCheckBox.Width;
|
||||
Caption:='Auto create forms';
|
||||
Visible:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
// form editor
|
||||
DisplayGridCheckBox:=TCheckBox.Create(Self);
|
||||
with DisplayGridCheckBox do begin
|
||||
Name:='DisplayGridCheckBox';
|
||||
// form editor page
|
||||
GridGroupBox:=TGroupBox.Create(Self);
|
||||
with GridGroupBox do begin
|
||||
Name:='GridGroupBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=6;
|
||||
Top:=2;
|
||||
Width:=200;
|
||||
Height:=23;
|
||||
Caption:='Display grid';
|
||||
Left:=5;
|
||||
Top:=5;
|
||||
Width:=((Parent.ClientWidth-3*Left) div 2);
|
||||
Height:=170;
|
||||
Caption:='Grid';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
SetupGridGroupBox;
|
||||
|
||||
GuideLinesGroupBox:=TGroupBox.Create(Self);
|
||||
with GuideLinesGroupBox do begin
|
||||
Name:='GuideLinesGroupBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=GridGroupBox.Left+GridGroupBox.Width+5;
|
||||
Top:=GridGroupBox.Top;
|
||||
Width:=GridGroupBox.Width;
|
||||
Height:=GridGroupBox.Height;
|
||||
Caption:='Guide lines';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
SetupGuideLinesGroupBox;
|
||||
|
||||
SnapToGridCheckBox:=TCheckBox.Create(Self);
|
||||
with SnapToGridCheckBox do begin
|
||||
Name:='SnapToGridCheckBox';
|
||||
FormEditMiscGroupBox:=TGroupBox.Create(Self);
|
||||
with FormEditMiscGroupBox do begin
|
||||
Name:='FormEditMiscGroupBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Top:=27;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
Caption:='Snap to grid';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
ShowComponentCaptionsCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowComponentCaptionsCheckBox do begin
|
||||
Name:='ShowComponentCaptionsCheckBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Top:=52;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
Caption:='Show component captions';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
ShowEditorHintsCheckBox:=TCheckBox.Create(Self);
|
||||
with ShowEditorHintsCheckBox do begin
|
||||
Name:='ShowEditorHintsCheckBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Top:=77;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
Caption:='Show editor hints';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
AutoCreateFormsCheckBox:=TCheckBox.Create(Self);
|
||||
with AutoCreateFormsCheckBox do begin
|
||||
Name:='AutoCreateFormsCheckBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Top:=102;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
Caption:='Auto create forms';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeXLabel:=TLabel.Create(Self);
|
||||
with GridSizeXLabel do begin
|
||||
Name:='GridSizeXLabel';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=6;
|
||||
Top:=129;
|
||||
Width:=80;
|
||||
Height:=20;
|
||||
Caption:='Grid size X';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeXComboBox:=TComboBox.Create(Self);
|
||||
with GridSizeXComboBox do begin
|
||||
Name:='GridSizeXComboBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=GridSizeXLabel.Left+GridSizeXLabel.Width+5;
|
||||
Top:=GridSizeXLabel.Top+2;
|
||||
Width:=60;
|
||||
Height:=23;
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add('2');
|
||||
Add('5');
|
||||
Add('8');
|
||||
Add('10');
|
||||
EndUpdate;
|
||||
end;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeYLabel:=TLabel.Create(Self);
|
||||
with GridSizeYLabel do begin
|
||||
Name:='GridSizeYLabel';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=6;
|
||||
Top:=154;
|
||||
Width:=GridSizeXLabel.Width;
|
||||
Height:=20;
|
||||
Caption:='Grid size Y';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
GridSizeYComboBox:=TComboBox.Create(Self);
|
||||
with GridSizeYComboBox do begin
|
||||
Name:='GridSizeYComboBox';
|
||||
Parent:=Notebook.Page[Page];
|
||||
Left:=GridSizeYLabel.Left+GridSizeYLabel.Width+5;
|
||||
Top:=GridSizeYLabel.Top+2;
|
||||
Width:=60;
|
||||
Height:=23;
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add('2');
|
||||
Add('5');
|
||||
Add('8');
|
||||
Add('10');
|
||||
EndUpdate;
|
||||
end;
|
||||
Left:=5;
|
||||
Top:=GridGroupBox.Top+GridGroupBox.Height+5;
|
||||
Width:=Parent.ClientWidth-2*Left;
|
||||
Height:=100;
|
||||
Caption:='Miscellaneous';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
SetupMiscGroupBox;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptionsDialog.SetupNamingPage(Page: integer);
|
||||
@ -1948,70 +2148,126 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptionsDialog.ResizeFormEditorPage;
|
||||
|
||||
procedure SetupGridGroupBox;
|
||||
begin
|
||||
with ShowGridCheckBox do begin
|
||||
SetBounds(6,2,200,Height);
|
||||
end;
|
||||
|
||||
with GridColorButton do begin
|
||||
SetBounds(ShowGridCheckBox.Left,
|
||||
ShowGridCheckBox.Top+ShowGridCheckBox.Height+5,
|
||||
50,25);
|
||||
end;
|
||||
|
||||
with GridColorLabel do begin
|
||||
SetBounds(GridColorButton.Left+GridColorButton.Width+5,
|
||||
GridColorButton.Top+2,80,Height);
|
||||
end;
|
||||
|
||||
with SnapToGridCheckBox do begin
|
||||
SetBounds(ShowGridCheckBox.Left,
|
||||
GridColorLabel.Top+GridColorLabel.Height+10,
|
||||
ShowGridCheckBox.Width,
|
||||
ShowGridCheckBox.Height);
|
||||
end;
|
||||
|
||||
with GridSizeXLabel do begin
|
||||
SetBounds(ShowGridCheckBox.Left,
|
||||
SnapToGridCheckBox.Top+SnapToGridCheckBox.Height+5,80,Height);
|
||||
end;
|
||||
|
||||
with GridSizeXComboBox do begin
|
||||
SetBounds(GridSizeXLabel.Left+GridSizeXLabel.Width+5,
|
||||
GridSizeXLabel.Top-2,60,Height);
|
||||
end;
|
||||
|
||||
with GridSizeYLabel do begin
|
||||
SetBounds(GridSizeXLabel.Left,
|
||||
GridSizeXLabel.Top+GridSizeXLabel.Height+5,
|
||||
GridSizeXLabel.Width,Height);
|
||||
end;
|
||||
|
||||
with GridSizeYComboBox do begin
|
||||
SetBounds(GridSizeYLabel.Left+GridSizeYLabel.Width+5,
|
||||
GridSizeYLabel.Top-2,
|
||||
GridSizeXComboBox.Width,Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetupGuideLinesGroupBox;
|
||||
begin
|
||||
with ShowGuideLinesCheckBox do begin
|
||||
SetBounds(5,5,Parent.ClientWidth-2*Left,Height);
|
||||
end;
|
||||
|
||||
with SnapToGuideLinesCheckBox do begin
|
||||
SetBounds(ShowGuideLinesCheckBox.Left,
|
||||
ShowGuideLinesCheckBox.Top+ShowGuideLinesCheckBox.Height+5,
|
||||
ShowGuideLinesCheckBox.Width,Height);
|
||||
end;
|
||||
|
||||
with GuideLineColorLeftTopButton do begin
|
||||
SetBounds(SnapToGuideLinesCheckBox.Left,
|
||||
SnapToGuideLinesCheckBox.Top+SnapToGuideLinesCheckBox.Height+5,
|
||||
50,25);
|
||||
end;
|
||||
|
||||
with GuideLineColorLeftTopLabel do begin
|
||||
SetBounds(GuideLineColorLeftTopButton.Left+GuideLineColorLeftTopButton.Width+5,
|
||||
GuideLineColorLeftTopButton.Top+2,150,Height);
|
||||
end;
|
||||
|
||||
with GuideLineColorRightBottomButton do begin
|
||||
SetBounds(GuideLineColorLeftTopButton.Left,
|
||||
GuideLineColorLeftTopButton.Top
|
||||
+GuideLineColorLeftTopButton.Height+5,50,25);
|
||||
end;
|
||||
|
||||
with GuideLineColorRightBottomLabel do begin
|
||||
SetBounds(GuideLineColorLeftTopLabel.Left,
|
||||
GuideLineColorRightBottomButton.Top+2,
|
||||
GuideLineColorLeftTopLabel.Width,Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetupMiscGroupBox;
|
||||
begin
|
||||
with ShowComponentCaptionsCheckBox do begin
|
||||
SetBounds(5,5,Parent.ClientWidth-2*Left,Height);
|
||||
end;
|
||||
|
||||
with ShowEditorHintsCheckBox do begin
|
||||
SetBounds(ShowComponentCaptionsCheckBox.Left,
|
||||
ShowComponentCaptionsCheckBox.Top
|
||||
+ShowComponentCaptionsCheckBox.Height+5,
|
||||
ShowComponentCaptionsCheckBox.Width,Height);
|
||||
end;
|
||||
|
||||
with AutoCreateFormsCheckBox do begin
|
||||
SetBounds(ShowEditorHintsCheckBox.Left,
|
||||
ShowEditorHintsCheckBox.Top+ShowEditorHintsCheckBox.Height+5,
|
||||
ShowEditorHintsCheckBox.Width,Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
// form editor
|
||||
with DisplayGridCheckBox do begin
|
||||
Left:=6;
|
||||
Top:=2;
|
||||
Width:=200;
|
||||
Height:=23;
|
||||
// form editor page
|
||||
with GridGroupBox do begin
|
||||
SetBounds(5,5,((Parent.ClientWidth-3*Left) div 2),170);
|
||||
end;
|
||||
|
||||
with SnapToGridCheckBox do begin
|
||||
Top:=27;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
SetupGridGroupBox;
|
||||
with GuideLinesGroupBox do begin
|
||||
SetBounds(GridGroupBox.Left+GridGroupBox.Width+5,GridGroupBox.Top,
|
||||
GridGroupBox.Width,GridGroupBox.Height);
|
||||
end;
|
||||
|
||||
with ShowComponentCaptionsCheckBox do begin
|
||||
Top:=52;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
end;
|
||||
|
||||
with ShowEditorHintsCheckBox do begin
|
||||
Top:=77;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
end;
|
||||
|
||||
with AutoCreateFormsCheckBox do begin
|
||||
Top:=102;
|
||||
Left:=DisplayGridCheckBox.Left;
|
||||
Width:=DisplayGridCheckBox.Width;
|
||||
Height:=DisplayGridCheckBox.Height;
|
||||
end;
|
||||
|
||||
with GridSizeXLabel do begin
|
||||
Left:=6;
|
||||
Top:=129;
|
||||
Width:=80;
|
||||
Height:=20;
|
||||
end;
|
||||
|
||||
with GridSizeXComboBox do begin
|
||||
Left:=GridSizeXLabel.Left+GridSizeXLabel.Width+5;
|
||||
Top:=GridSizeXLabel.Top+2;
|
||||
Width:=60;
|
||||
Height:=23;
|
||||
end;
|
||||
|
||||
with GridSizeYLabel do begin
|
||||
Left:=6;
|
||||
Top:=154;
|
||||
Width:=GridSizeXLabel.Width;
|
||||
Height:=20;
|
||||
end;
|
||||
|
||||
with GridSizeYComboBox do begin
|
||||
Left:=GridSizeYLabel.Left+GridSizeYLabel.Width+5;
|
||||
Top:=GridSizeYLabel.Top+2;
|
||||
Width:=60;
|
||||
Height:=23;
|
||||
SetupGuideLinesGroupBox;
|
||||
with FormEditMiscGroupBox do begin
|
||||
SetBounds(5,GridGroupBox.Top+GridGroupBox.Height+5,
|
||||
Parent.ClientWidth-2*Left,100);
|
||||
end;
|
||||
SetupMiscGroupBox;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptionsDialog.ResizeObjectInspectorPage;
|
||||
@ -2464,13 +2720,18 @@ begin
|
||||
ShowHintsForMainSpeedButtons;
|
||||
|
||||
// form editor
|
||||
DisplayGridCheckBox.Checked:=DisplayGrid;
|
||||
ShowGridCheckBox.Checked:=ShowGrid;
|
||||
GridColorButton.ButtonColor:=GridColor;
|
||||
SnapToGridCheckBox.Checked:=SnapToGrid;
|
||||
SetComboBoxText(GridSizeXComboBox,IntToStr(GridSizeX));
|
||||
SetComboBoxText(GridSizeYComboBox,IntToStr(GridSizeY));
|
||||
ShowGuideLinesCheckBox.Checked:=ShowGuideLines;
|
||||
SnapToGuideLinesCheckBox.Checked:=SnapToGuideLines;
|
||||
GuideLineColorLeftTopButton.ButtonColor:=GuideLineColorLeftTop;
|
||||
GuideLineColorRightBottomButton.ButtonColor:=GuideLineColorRightBottom;
|
||||
ShowComponentCaptionsCheckBox.Checked:=ShowComponentCaptions;
|
||||
ShowEditorHintsCheckBox.Checked:=ShowEditorHints;
|
||||
AutoCreateFormsCheckBox.Checked:=AutoCreateForms;
|
||||
SetComboBoxText(GridSizeXComboBox,IntToStr(GridSizeX));
|
||||
SetComboBoxText(GridSizeYComboBox,IntToStr(GridSizeY));
|
||||
|
||||
// files
|
||||
LazarusDirComboBox.Items.Assign(LazarusDirHistory);
|
||||
@ -2562,13 +2823,18 @@ begin
|
||||
ShowHintsForMainSpeedButtons:=ShowHintsForMainSpeedButtonsCheckBox.Checked;
|
||||
|
||||
// form editor
|
||||
DisplayGrid:=DisplayGridCheckBox.Checked;
|
||||
ShowGrid:=ShowGridCheckBox.Checked;
|
||||
GridColor:=GridColorButton.ButtonColor;
|
||||
SnapToGrid:=SnapToGridCheckBox.Checked;
|
||||
GridSizeX:=StrToIntDef(GridSizeXComboBox.Text,GridSizeX);
|
||||
GridSizeY:=StrToIntDef(GridSizeYComboBox.Text,GridSizeY);
|
||||
ShowGuideLines:=ShowGuideLinesCheckBox.Checked;
|
||||
SnapToGuideLines:=SnapToGridCheckBox.Checked;
|
||||
GuideLineColorLeftTop:=GuideLineColorLeftTopButton.ButtonColor;
|
||||
GuideLineColorRightBottom:=GuideLineColorRightBottomButton.ButtonColor;
|
||||
ShowComponentCaptions:=ShowComponentCaptionsCheckBox.Checked;
|
||||
ShowEditorHints:=ShowEditorHintsCheckBox.Checked;
|
||||
AutoCreateForms:=AutoCreateFormsCheckBox.Checked;
|
||||
GridSizeX:=StrToIntDef(GridSizeXComboBox.Text,GridSizeX);
|
||||
GridSizeY:=StrToIntDef(GridSizeYComboBox.Text,GridSizeY);
|
||||
|
||||
// files
|
||||
LazarusDirectory:=LazarusDirComboBox.Text;
|
||||
|
21
ide/main.pp
21
ide/main.pp
@ -5390,13 +5390,15 @@ end;
|
||||
|
||||
procedure TMainIDE.OnDesignerModified(Sender: TObject);
|
||||
var i: integer;
|
||||
SrcEdit: TSourceEditor;
|
||||
begin
|
||||
i:=Project1.IndexOfUnitWithForm(TDesigner(Sender).Form,false);
|
||||
if i>=0 then begin
|
||||
Project1.Units[i].Modified:=true;
|
||||
if Project1.Units[i].Loaded then
|
||||
SourceNotebook.FindSourceEditorWithPageIndex(
|
||||
Project1.Units[i].EditorIndex).EditorComponent.Modified:=true;
|
||||
SrcEdit:=SourceNotebook.FindSourceEditorWithPageIndex(
|
||||
Project1.Units[i].EditorIndex);
|
||||
if SrcEdit<>nil then SrcEdit.EditorComponent.Modified:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -5404,9 +5406,9 @@ procedure TMainIDE.OnControlSelectionChanged(Sender: TObject);
|
||||
var NewSelectedComponents : TComponentSelectionList;
|
||||
i: integer;
|
||||
begin
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.OnControlSelectionChanged]');
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.OnControlSelectionChanged]');
|
||||
{$ENDIF}
|
||||
if (TheControlSelection=nil) or (FormEditor1=nil) then exit;
|
||||
NewSelectedComponents:=TComponentSelectionList.Create;
|
||||
for i:=0 to TheControlSelection.Count-1 do begin
|
||||
@ -5414,9 +5416,9 @@ writeln('[TMainIDE.OnControlSelectionChanged]');
|
||||
end;
|
||||
FormEditor1.SelectedComponents:=NewSelectedComponents;
|
||||
NewSelectedComponents.Free;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.OnControlSelectionChanged] END');
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.OnControlSelectionChanged] END');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -6501,6 +6503,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.314 2002/06/19 19:46:05 lazarus
|
||||
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...
|
||||
|
||||
Revision 1.313 2002/06/14 14:57:05 lazarus
|
||||
MG: fixed open file at cursor search path
|
||||
|
||||
|
@ -2334,7 +2334,7 @@ end;
|
||||
Params: Sender : TObject
|
||||
Result: none
|
||||
|
||||
Called whenever an editor status changes.
|
||||
Called whenever an editor status changes. Sender is normally a TSynEdit.
|
||||
-------------------------------------------------------------------------------}
|
||||
Procedure TSourceNotebook.EditorChanged(Sender : TObject);
|
||||
var SenderDeleted: boolean;
|
||||
|
@ -141,7 +141,7 @@ type
|
||||
procedure UpdateWindowState;
|
||||
procedure ValidateRename(AComponent: TComponent;
|
||||
const CurName, NewName: string);override;
|
||||
procedure WndProc(var Message : TLMessage); override;
|
||||
procedure WndProc(var TheMessage : TLMessage); override;
|
||||
{events}
|
||||
property ActiveControl : TWinControl read FActiveControl write SetActiveControl;
|
||||
property Icon: TIcon read FIcon write SetIcon stored IsIconStored;
|
||||
|
@ -494,7 +494,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomForm WndProc }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomForm.WndProc(Var Message : TLMessage);
|
||||
procedure TCustomForm.WndProc(Var TheMessage : TLMessage);
|
||||
var
|
||||
FocusHandle : HWND;
|
||||
// SaveIndex : Integer;
|
||||
@ -504,7 +504,7 @@ var
|
||||
|
||||
begin
|
||||
// Assert(False, 'Trace:-----------------IN TCUSTOMFORM WNDPROC-------------------');
|
||||
with Message do
|
||||
with TheMessage do
|
||||
case Msg of
|
||||
LM_ACTIVATE, LM_SETFOCUS, LM_KILLFOCUS:
|
||||
begin
|
||||
@ -525,7 +525,7 @@ begin
|
||||
LCLLinux.SetFocus(FocusHandle);
|
||||
Exit;
|
||||
end;
|
||||
Message.Result:=0;
|
||||
TheMessage.Result:=0;
|
||||
end;
|
||||
end;
|
||||
CM_EXIT:
|
||||
@ -541,14 +541,18 @@ begin
|
||||
then begin
|
||||
if (Position in [poDefault, poDefaultPosOnly])
|
||||
and (WindowState <> wsMaximized)
|
||||
then with PWindowPos(Message.lParam)^ do flags := flags or SWP_NOMOVE;
|
||||
then
|
||||
with PWindowPos(TheMessage.lParam)^ do
|
||||
flags := flags or SWP_NOMOVE;
|
||||
|
||||
if (Position in [poDefault, poDefaultSizeOnly])
|
||||
and (BorderStyle in [bsSizeable, bsSizeToolWin])
|
||||
then with PWindowPos(Message.lParam)^ do flags := flags or SWP_NOSIZE;
|
||||
then
|
||||
with PWindowPos(TheMessage.lParam)^ do
|
||||
flags := flags or SWP_NOSIZE;
|
||||
end;
|
||||
LM_DRAWITEM:
|
||||
with PDrawItemStruct(Message.LParam)^ do
|
||||
with PDrawItemStruct(TheMessage.LParam)^ do
|
||||
begin
|
||||
if (CtlType = ODT_MENU) and Assigned(Menu)
|
||||
then begin
|
||||
@ -618,7 +622,7 @@ riteln('[TCustomForm.WndPRoc] 1');
|
||||
Assert(False, 'Trace:LM_SHOWWINDOW RECEIVED!!!!!!!!!!!');
|
||||
end;
|
||||
end;
|
||||
inherited WndProc(Message);
|
||||
inherited WndProc(TheMessage);
|
||||
end;
|
||||
|
||||
|
||||
@ -1033,6 +1037,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.48 2002/06/19 19:46:09 lazarus
|
||||
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...
|
||||
|
||||
Revision 1.47 2002/05/30 21:17:27 lazarus
|
||||
lcl/controls.pp
|
||||
|
||||
|
@ -28,24 +28,24 @@ var
|
||||
LastFileSelectRow : gint;
|
||||
|
||||
|
||||
function DeliverPostMessage(const Target: Pointer; var Message): GBoolean;
|
||||
function DeliverPostMessage(const Target: Pointer; var TheMessage): GBoolean;
|
||||
begin
|
||||
if TObject(Target) is TWinControl then
|
||||
begin
|
||||
Result := PostMessage(TWinControl(Target).Handle, TLMessage(Message).Msg,
|
||||
TLMessage(Message).WParam, TLMessage(Message).LParam);
|
||||
Result := PostMessage(TWinControl(Target).Handle, TLMessage(TheMessage).Msg,
|
||||
TLMessage(TheMessage).WParam, TLMessage(TheMessage).LParam);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := DeliverMessage(Target, Message) = 0;
|
||||
Result := DeliverMessage(Target, TheMessage) = 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure EventTrace(message : string; data : pointer);
|
||||
procedure EventTrace(Themessage : string; data : pointer);
|
||||
begin
|
||||
if Data = nil
|
||||
then Assert(False, Format('Trace:Event [%s] fired',[message]))
|
||||
else Assert(False, Format('Trace:Event [%s] fired for %s',[message, TObject(data).Classname]));
|
||||
then Assert(False, Format('Trace:Event [%s] fired',[Themessage]))
|
||||
else Assert(False, Format('Trace:Event [%s] fired for %s',[Themessage, TObject(data).Classname]));
|
||||
end;
|
||||
|
||||
{*************************************************************}
|
||||
@ -471,16 +471,11 @@ begin
|
||||
|
||||
DeliverPostMessage(Data, Msg);
|
||||
|
||||
if (Pointer(MCaptureHandle) <> widget)
|
||||
and (MCaptureHandle <> 0)
|
||||
then begin
|
||||
// capture differs. => gtk forgot to tell, that the capturing ended
|
||||
// -> end capturing
|
||||
|
||||
// ToDo: end capturing
|
||||
|
||||
WriteLN(Format('[GTKMotionNotify] Capture differs --> cap:0x%x gtk:0x%p',
|
||||
[MCaptureHandle, widget]));
|
||||
if (MCaptureHandle <> 0) and (Pointer(MCaptureHandle) <> widget) then
|
||||
begin
|
||||
// capture differs. => gtk forgot to tell, that the capturing has changed
|
||||
// -> update
|
||||
UpdateMouseCaptureControl;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2022,6 +2017,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.85 2002/06/19 19:46:09 lazarus
|
||||
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...
|
||||
|
||||
Revision 1.84 2002/06/11 13:41:09 lazarus
|
||||
MG: fixed mouse coords and fixed mouse clicked thru bug
|
||||
|
||||
|
@ -4133,7 +4133,7 @@ begin
|
||||
}
|
||||
// Writeln('SetCapture result is '+inttostr(result));
|
||||
if MCaptureHandle <> 0 then
|
||||
SendMessage(MCaptureHandle, LM_CAPTURECHANGED, 0, Result);
|
||||
SendMessage(MCaptureHandle, LM_CAPTURECHANGED, 0, Result);
|
||||
end;
|
||||
|
||||
Assert(False, Format('Trace:< [TgtkObject.SetCapture] 0x%x --> 0x%x', [Value, Result]));
|
||||
@ -4781,6 +4781,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.79 2002/06/19 19:46:10 lazarus
|
||||
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...
|
||||
|
||||
Revision 1.78 2002/06/12 12:35:44 lazarus
|
||||
MG: fixed apiwidget warnings/criticals
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user