mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 06:09:30 +02:00
designer: cancel move/resize operation on ESC key press (issue #0010981)
git-svn-id: trunk@21755 -
This commit is contained in:
parent
f4defcfde3
commit
6daf1895cc
@ -397,7 +397,6 @@ type
|
||||
procedure AssignSelection(const ASelection: TPersistentSelectionList);
|
||||
function IsSelected(APersistent: TPersistent): Boolean;
|
||||
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
||||
procedure SaveBounds;
|
||||
function ParentLevel: integer;
|
||||
function OnlyNonVisualPersistentsSelected: boolean;
|
||||
function OnlyVisualComponentsSelected: boolean;
|
||||
@ -409,7 +408,9 @@ type
|
||||
function IsResizing: boolean;
|
||||
procedure BeginResizing;
|
||||
procedure EndResizing(ApplyUserBounds: boolean);
|
||||
procedure SaveBounds;
|
||||
procedure UpdateBounds;
|
||||
procedure RestoreBounds;
|
||||
|
||||
procedure MoveSelection(dx, dy: integer);
|
||||
function MoveSelectionWithSnapping(TotalDX, TotalDY: integer): boolean;
|
||||
@ -1098,6 +1099,29 @@ begin
|
||||
Exclude(FStates,cssBoundsNeedsUpdate);
|
||||
end;
|
||||
|
||||
procedure TControlSelection.RestoreBounds;
|
||||
var
|
||||
i: integer;
|
||||
OldLeftTop: TPoint;
|
||||
begin
|
||||
BeginUpdate;
|
||||
FLeft := OldLeft;
|
||||
FTop := OldTop;
|
||||
FWidth := FOldWidth;
|
||||
FHeight := FOldHeight;
|
||||
for i := 0 to Count - 1 do
|
||||
begin
|
||||
with Items[i] do
|
||||
begin
|
||||
OldLeftTop := OldFormRelativeLeftTop;
|
||||
SetFormRelativeBounds(OldLeftTop.X, OldLeftTop.Y, OldWidth, OldHeight);
|
||||
end;
|
||||
InvalidateGuideLinesCache;
|
||||
end;
|
||||
UpdateRealBounds;
|
||||
EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TControlSelection.AdjustGrabbers;
|
||||
var g:TGrabIndex;
|
||||
OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer;
|
||||
@ -1931,22 +1955,25 @@ begin
|
||||
end;
|
||||
|
||||
procedure TControlSelection.SaveBounds;
|
||||
var i:integer;
|
||||
g:TGrabIndex;
|
||||
var
|
||||
i: integer;
|
||||
g: TGrabIndex;
|
||||
begin
|
||||
if cssNotSavingBounds in FStates then exit;
|
||||
//debugln('TControlSelection.SaveBounds');
|
||||
if FUpdateLock>0 then begin
|
||||
Include(FStates,cssBoundsNeedsSaving);
|
||||
exit;
|
||||
if FUpdateLock > 0 then
|
||||
begin
|
||||
Include(FStates, cssBoundsNeedsSaving);
|
||||
Exit;
|
||||
end;
|
||||
for i:=0 to FControls.Count-1 do Items[i].SaveBounds;
|
||||
for g:=Low(TGrabIndex) to High(TGrabIndex) do FGrabbers[g].SaveBounds;
|
||||
FOldLeft:=FRealLeft;
|
||||
FOldTop:=FRealTop;
|
||||
FOldWidth:=FRealWidth;
|
||||
FOldHeight:=FRealHeight;
|
||||
Exclude(FStates,cssBoundsNeedsSaving);
|
||||
|
||||
for i := 0 to FControls.Count - 1 do Items[i].SaveBounds;
|
||||
for g := Low(TGrabIndex) to High(TGrabIndex) do FGrabbers[g].SaveBounds;
|
||||
FOldLeft := FRealLeft;
|
||||
FOldTop := FRealTop;
|
||||
FOldWidth := FRealWidth;
|
||||
FOldHeight := FRealHeight;
|
||||
Exclude(FStates, cssBoundsNeedsSaving);
|
||||
end;
|
||||
|
||||
function TControlSelection.IsResizing: boolean;
|
||||
|
@ -735,12 +735,14 @@ procedure TDesigner.SelectParentOfSelection;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if ControlSelection.ActiveGrabber <> nil then
|
||||
// resizing or moving
|
||||
if dfHasSized in FFlags then
|
||||
begin
|
||||
ControlSelection.RestoreBounds;
|
||||
ControlSelection.ActiveGrabber := nil;
|
||||
if ControlSelection.RubberbandActive then
|
||||
ControlSelection.RubberbandActive := False;
|
||||
LastMouseMovePos.X:=-1;
|
||||
LastMouseMovePos.X := -1;
|
||||
Exclude(FFlags, dfHasSized);
|
||||
MouseDownComponent := nil;
|
||||
MouseDownSender := nil;
|
||||
@ -756,6 +758,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// if not component moving then select parent
|
||||
i:=ControlSelection.Count-1;
|
||||
while (i>=0)
|
||||
and ( (ControlSelection[i].ParentInSelection)
|
||||
|
Loading…
Reference in New Issue
Block a user