mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 22:39:11 +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);
|
procedure AssignSelection(const ASelection: TPersistentSelectionList);
|
||||||
function IsSelected(APersistent: TPersistent): Boolean;
|
function IsSelected(APersistent: TPersistent): Boolean;
|
||||||
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
||||||
procedure SaveBounds;
|
|
||||||
function ParentLevel: integer;
|
function ParentLevel: integer;
|
||||||
function OnlyNonVisualPersistentsSelected: boolean;
|
function OnlyNonVisualPersistentsSelected: boolean;
|
||||||
function OnlyVisualComponentsSelected: boolean;
|
function OnlyVisualComponentsSelected: boolean;
|
||||||
@ -409,7 +408,9 @@ type
|
|||||||
function IsResizing: boolean;
|
function IsResizing: boolean;
|
||||||
procedure BeginResizing;
|
procedure BeginResizing;
|
||||||
procedure EndResizing(ApplyUserBounds: boolean);
|
procedure EndResizing(ApplyUserBounds: boolean);
|
||||||
|
procedure SaveBounds;
|
||||||
procedure UpdateBounds;
|
procedure UpdateBounds;
|
||||||
|
procedure RestoreBounds;
|
||||||
|
|
||||||
procedure MoveSelection(dx, dy: integer);
|
procedure MoveSelection(dx, dy: integer);
|
||||||
function MoveSelectionWithSnapping(TotalDX, TotalDY: integer): boolean;
|
function MoveSelectionWithSnapping(TotalDX, TotalDY: integer): boolean;
|
||||||
@ -1098,6 +1099,29 @@ begin
|
|||||||
Exclude(FStates,cssBoundsNeedsUpdate);
|
Exclude(FStates,cssBoundsNeedsUpdate);
|
||||||
end;
|
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;
|
procedure TControlSelection.AdjustGrabbers;
|
||||||
var g:TGrabIndex;
|
var g:TGrabIndex;
|
||||||
OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer;
|
OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer;
|
||||||
@ -1931,22 +1955,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlSelection.SaveBounds;
|
procedure TControlSelection.SaveBounds;
|
||||||
var i:integer;
|
var
|
||||||
g:TGrabIndex;
|
i: integer;
|
||||||
|
g: TGrabIndex;
|
||||||
begin
|
begin
|
||||||
if cssNotSavingBounds in FStates then exit;
|
if cssNotSavingBounds in FStates then exit;
|
||||||
//debugln('TControlSelection.SaveBounds');
|
//debugln('TControlSelection.SaveBounds');
|
||||||
if FUpdateLock>0 then begin
|
if FUpdateLock > 0 then
|
||||||
Include(FStates,cssBoundsNeedsSaving);
|
begin
|
||||||
exit;
|
Include(FStates, cssBoundsNeedsSaving);
|
||||||
|
Exit;
|
||||||
end;
|
end;
|
||||||
for i:=0 to FControls.Count-1 do Items[i].SaveBounds;
|
|
||||||
for g:=Low(TGrabIndex) to High(TGrabIndex) do FGrabbers[g].SaveBounds;
|
for i := 0 to FControls.Count - 1 do Items[i].SaveBounds;
|
||||||
FOldLeft:=FRealLeft;
|
for g := Low(TGrabIndex) to High(TGrabIndex) do FGrabbers[g].SaveBounds;
|
||||||
FOldTop:=FRealTop;
|
FOldLeft := FRealLeft;
|
||||||
FOldWidth:=FRealWidth;
|
FOldTop := FRealTop;
|
||||||
FOldHeight:=FRealHeight;
|
FOldWidth := FRealWidth;
|
||||||
Exclude(FStates,cssBoundsNeedsSaving);
|
FOldHeight := FRealHeight;
|
||||||
|
Exclude(FStates, cssBoundsNeedsSaving);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControlSelection.IsResizing: boolean;
|
function TControlSelection.IsResizing: boolean;
|
||||||
|
@ -735,12 +735,14 @@ procedure TDesigner.SelectParentOfSelection;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if ControlSelection.ActiveGrabber <> nil then
|
// resizing or moving
|
||||||
|
if dfHasSized in FFlags then
|
||||||
begin
|
begin
|
||||||
|
ControlSelection.RestoreBounds;
|
||||||
ControlSelection.ActiveGrabber := nil;
|
ControlSelection.ActiveGrabber := nil;
|
||||||
if ControlSelection.RubberbandActive then
|
if ControlSelection.RubberbandActive then
|
||||||
ControlSelection.RubberbandActive := False;
|
ControlSelection.RubberbandActive := False;
|
||||||
LastMouseMovePos.X:=-1;
|
LastMouseMovePos.X := -1;
|
||||||
Exclude(FFlags, dfHasSized);
|
Exclude(FFlags, dfHasSized);
|
||||||
MouseDownComponent := nil;
|
MouseDownComponent := nil;
|
||||||
MouseDownSender := nil;
|
MouseDownSender := nil;
|
||||||
@ -756,6 +758,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// if not component moving then select parent
|
||||||
i:=ControlSelection.Count-1;
|
i:=ControlSelection.Count-1;
|
||||||
while (i>=0)
|
while (i>=0)
|
||||||
and ( (ControlSelection[i].ParentInSelection)
|
and ( (ControlSelection[i].ParentInSelection)
|
||||||
|
Loading…
Reference in New Issue
Block a user