IDE: pasting controls: delay autosizing to keep layout of multi selection

git-svn-id: trunk@24380 -
This commit is contained in:
mattias 2010-04-03 16:21:48 +00:00
parent 3729314672
commit b32f435668
2 changed files with 75 additions and 66 deletions

View File

@ -1183,57 +1183,66 @@ begin
if PasteParent=nil then PasteParent:=GetPasteParent;
NewSelection:=TControlSelection.Create;
try
{$IFNDEF OldAutoSize}
Form.DisableAutoSizing;
{$ENDIF}
try
// read component stream from clipboard
if (s.Size<=S.Position) then begin
debugln('TDesigner.DoInsertFromStream Stream Empty s.Size=',dbgs(s.Size),' S.Position=',dbgs(S.Position));
exit;
end;
l:=s.Size-s.Position;
SetLength(AllComponentText,l);
s.Read(AllComponentText[1],length(AllComponentText));
StartPos:=1;
EndPos:=StartPos;
// read till 'end'
while EndPos<=length(AllComponentText) do begin
//debugln('TDesigner.DoInsertFromStream C');
if (AllComponentText[EndPos] in ['e','E'])
and (EndPos>1)
and (AllComponentText[EndPos-1] in [#10,#13])
and (CompareText(copy(AllComponentText,EndPos,3),'END')=0)
and ((EndPos+3>length(AllComponentText))
or (AllComponentText[EndPos+3] in [#10,#13]))
then begin
inc(EndPos,4);
while (EndPos<=length(AllComponentText))
and (AllComponentText[EndPos] in [' ',#10,#13])
do
inc(EndPos);
// extract text for the current component
{$IFDEF VerboseDesigner}
DebugLn('TDesigner.DoInsertFromStream==============================');
DebugLn(copy(AllComponentText,StartPos,EndPos-StartPos));
DebugLn('TDesigner.DoInsertFromStream==============================');
{$ENDIF}
CurTextCompStream:=TMemoryStream.Create;
try
CurTextCompStream.Write(AllComponentText[StartPos],EndPos-StartPos);
CurTextCompStream.Position:=0;
// create component from stream
if not PasteComponent(CurTextCompStream) then exit;
finally
CurTextCompStream.Free;
end;
StartPos:=EndPos;
end else begin
inc(EndPos);
// read component stream from clipboard
if (s.Size<=S.Position) then begin
debugln('TDesigner.DoInsertFromStream Stream Empty s.Size=',dbgs(s.Size),' S.Position=',dbgs(S.Position));
exit;
end;
end;
l:=s.Size-s.Position;
SetLength(AllComponentText,l);
s.Read(AllComponentText[1],length(AllComponentText));
StartPos:=1;
EndPos:=StartPos;
// read till 'end'
while EndPos<=length(AllComponentText) do begin
//debugln('TDesigner.DoInsertFromStream C');
if (AllComponentText[EndPos] in ['e','E'])
and (EndPos>1)
and (AllComponentText[EndPos-1] in [#10,#13])
and (CompareText(copy(AllComponentText,EndPos,3),'END')=0)
and ((EndPos+3>length(AllComponentText))
or (AllComponentText[EndPos+3] in [#10,#13]))
then begin
inc(EndPos,4);
while (EndPos<=length(AllComponentText))
and (AllComponentText[EndPos] in [' ',#10,#13])
do
inc(EndPos);
// extract text for the current component
{$IFDEF VerboseDesigner}
DebugLn('TDesigner.DoInsertFromStream==============================');
DebugLn(copy(AllComponentText,StartPos,EndPos-StartPos));
DebugLn('TDesigner.DoInsertFromStream==============================');
{$ENDIF}
CurTextCompStream:=TMemoryStream.Create;
try
CurTextCompStream.Write(AllComponentText[StartPos],EndPos-StartPos);
CurTextCompStream.Position:=0;
// create component from stream
if not PasteComponent(CurTextCompStream) then exit;
finally
CurTextCompStream.Free;
end;
StartPos:=EndPos;
end else begin
inc(EndPos);
end;
end;
finally
{$IFNDEF OldAutoSize}
Form.EnableAutoSizing;
{$ENDIF}
end;
finally
if NewSelection.Count>0 then
ControlSelection.Assign(NewSelection);

View File

@ -1,12 +1,12 @@
object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 379
Height = 530
Height = 521
Top = 155
Width = 420
Width = 456
ActiveControl = TextToFindComboBox
Caption = 'Find in files'
ClientHeight = 530
ClientWidth = 420
ClientHeight = 521
ClientWidth = 456
Constraints.MinHeight = 400
Constraints.MinWidth = 260
OnClose = FormClose
@ -29,7 +29,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 88
Height = 29
Top = 6
Width = 326
Width = 362
Anchors = [akTop, akLeft, akRight]
AutoComplete = True
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
@ -46,7 +46,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 6
Height = 137
Top = 72
Width = 408
Width = 444
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
@ -82,7 +82,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 6
Height = 109
Top = 215
Width = 408
Width = 444
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
@ -99,7 +99,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 90
ClientWidth = 404
ClientWidth = 440
ItemIndex = 1
Items.Strings = (
'search all files in project'
@ -118,14 +118,14 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1
Left = 6
Height = 156
Height = 147
Top = 330
Width = 408
Width = 444
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'Directory Options'
ClientHeight = 137
ClientWidth = 404
ClientHeight = 128
ClientWidth = 440
Enabled = False
TabOrder = 3
object DirectoryLabel: TLabel
@ -150,13 +150,13 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 68
Height = 29
Top = 6
Width = 272
Width = 308
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
TabOrder = 0
end
object DirectoryBrowse: TBitBtn
Left = 346
Left = 382
Height = 25
Top = 6
Width = 25
@ -171,7 +171,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 6
Height = 29
Top = 56
Width = 334
Width = 370
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
TabOrder = 2
@ -194,7 +194,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
Left = 84
Height = 29
Top = 37
Width = 330
Width = 366
Anchors = [akTop, akLeft, akRight]
AutoComplete = True
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
@ -219,8 +219,8 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
object ButtonPanel1: TButtonPanel
Left = 6
Height = 32
Top = 492
Width = 408
Top = 483
Width = 444
TabOrder = 6
ShowButtons = [pbOK, pbCancel, pbHelp]
ShowBevel = False