mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 18:19:23 +02:00
IDE: designer: fixed updating undo bounds on mouse up
git-svn-id: trunk@46479 -
This commit is contained in:
parent
20540fd87b
commit
1fada3022b
@ -2381,6 +2381,7 @@ var
|
|||||||
var
|
var
|
||||||
Handled: Boolean;
|
Handled: Boolean;
|
||||||
i, j: Integer;
|
i, j: Integer;
|
||||||
|
SelectedPersistent: TSelectedControl;
|
||||||
begin
|
begin
|
||||||
FHintTimer.Enabled := False;
|
FHintTimer.Enabled := False;
|
||||||
FHintWindow.Visible := False;
|
FHintWindow.Visible := False;
|
||||||
@ -2437,28 +2438,44 @@ begin
|
|||||||
begin
|
begin
|
||||||
if SelectedCompClass = nil then
|
if SelectedCompClass = nil then
|
||||||
begin
|
begin
|
||||||
if (FUndoState = ucsSaveChange) and (FUndoCurr > 4) then
|
if (FUndoState = ucsSaveChange) then
|
||||||
begin
|
begin
|
||||||
j := FUndoCurr - ControlSelection.Count * 4;
|
// update undo list stored component bounds (Left, Top, Width, Height)
|
||||||
/// This is for finding reasons for a bug.
|
// see TControlSelection.EndResizing
|
||||||
if (j < 0) or (j < Low(FUndoList)) or (j >= High(FUndoList)-ControlSelection.Count*4) then
|
// the list of all TComponent, Left,Top,Width,Height
|
||||||
raise Exception.CreateFmt(
|
// Note: not every component has all four properties.
|
||||||
'MouseUpOnControl: FUndoList index=%d, High(FUndoList)=%d, FUndoCurr=%d, # of Controls=%d.',
|
j := FUndoCurr - 1;
|
||||||
[j, High(FUndoList), FUndoCurr, ControlSelection.Count]);
|
i := ControlSelection.Count-1;
|
||||||
///
|
while i>=0 do
|
||||||
for i := 0 to ControlSelection.Count - 1 do
|
|
||||||
begin
|
begin
|
||||||
if (FUndoList[j].fieldName = 'Top')
|
SelectedPersistent:=ControlSelection.Items[i];
|
||||||
and (FUndoList[j + 1].fieldName = 'Left')
|
if SelectedPersistent.IsTComponent then
|
||||||
and (FUndoList[j + 2].fieldName = 'Height')
|
|
||||||
and (FUndoList[j + 3].fieldName = 'Width') then
|
|
||||||
begin
|
begin
|
||||||
FUndoList[j].newVal := ControlSelection.Items[i].Top;
|
while (j>=0) do
|
||||||
FUndoList[j + 1].newVal := ControlSelection.Items[i].Left;
|
begin
|
||||||
FUndoList[j + 2].newVal := ControlSelection.Items[i].Height;
|
if (FUndoList[j].compName <> TComponent(SelectedPersistent.Persistent).Name)
|
||||||
FUndoList[j + 3].newVal := ControlSelection.Items[i].Width;
|
then begin
|
||||||
|
// this is not a list of bounds -> stop
|
||||||
|
i:=0;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
if (FUndoList[j].fieldName = 'Width') then
|
||||||
|
FUndoList[j].newVal := SelectedPersistent.Width
|
||||||
|
else if (FUndoList[j].fieldName = 'Height') then
|
||||||
|
FUndoList[j].newVal := SelectedPersistent.Height
|
||||||
|
else if (FUndoList[j].fieldName = 'Left') then
|
||||||
|
FUndoList[j].newVal := SelectedPersistent.Left
|
||||||
|
else if (FUndoList[j].fieldName = 'Top') then
|
||||||
|
FUndoList[j].newVal := SelectedPersistent.Top
|
||||||
|
else begin
|
||||||
|
// this is not a list of bounds -> stop
|
||||||
|
i:=0;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
dec(j);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
j := j + 4;
|
dec(i);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
FUndoState := ucsNone;
|
FUndoState := ucsNone;
|
||||||
|
Loading…
Reference in New Issue
Block a user