Unit info dlg: added button to jump to include directive

git-svn-id: trunk@9703 -
This commit is contained in:
mattias 2006-08-06 08:47:09 +00:00
parent b4de789eaa
commit a97b122dcc
6 changed files with 366 additions and 321 deletions

View File

@ -170,6 +170,9 @@ resourcestring
lisMenuInsertText = 'Insert text'; lisMenuInsertText = 'Insert text';
lisMenuInsertCVSKeyword = 'CVS keyword'; lisMenuInsertCVSKeyword = 'CVS keyword';
lisMenuInsertGeneral = 'General'; lisMenuInsertGeneral = 'General';
lisUnitPaths = 'Unit paths';
lisIncludePaths = 'Include paths';
lisSourcePaths = 'Source paths';
lisMenuCompleteCode = 'Complete Code'; lisMenuCompleteCode = 'Complete Code';
lisMenuExtractProc = 'Extract procedure ...'; lisMenuExtractProc = 'Extract procedure ...';
lisMenuFindIdentifierRefs = 'Find Identifier References ...'; lisMenuFindIdentifierRefs = 'Find Identifier References ...';

View File

@ -6351,13 +6351,14 @@ var ActiveSrcEdit:TSourceEditor;
ActiveUnitInfo:TUnitInfo; ActiveUnitInfo:TUnitInfo;
ShortUnitName, AFilename, FileDir: string; ShortUnitName, AFilename, FileDir: string;
ClearIncludedByFile: boolean; ClearIncludedByFile: boolean;
DlgResult: TModalResult;
begin begin
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo); GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil) then exit; if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil) then exit;
ShortUnitName:=ActiveSrcEdit.PageName; ShortUnitName:=ActiveSrcEdit.PageName;
AFilename:=ActiveUnitInfo.Filename; AFilename:=ActiveUnitInfo.Filename;
FileDir:=ExtractFilePath(AFilename); FileDir:=ExtractFilePath(AFilename);
ShowUnitInfoDlg(ShortUnitName, DlgResult:=ShowUnitInfoDlg(ShortUnitName,
LazSyntaxHighlighterNames[ActiveUnitInfo.SyntaxHighlighter], LazSyntaxHighlighterNames[ActiveUnitInfo.SyntaxHighlighter],
ActiveUnitInfo.IsPartOfProject, length(ActiveSrcEdit.Source.Text), ActiveUnitInfo.IsPartOfProject, length(ActiveSrcEdit.Source.Text),
ActiveSrcEdit.Source.Count, ActiveSrcEdit.Source.Count,
@ -6370,6 +6371,8 @@ begin
); );
if ClearIncludedByFile then if ClearIncludedByFile then
ActiveUnitInfo.Source.LastIncludedByFile:=''; ActiveUnitInfo.Source.LastIncludedByFile:='';
if (DlgResult=mrYes) and (ActiveUnitInfo.Source.LastIncludedByFile<>'') then
DoGotoIncludeDirective;
end; end;
procedure TMainIDE.DoShowCodeExplorer; procedure TMainIDE.DoShowCodeExplorer;

View File

@ -1,290 +1,293 @@
object UnitInfoDialog: TUnitInfoDialog object UnitInfoDialog: TUnitInfoDialog
ActiveControl = OkButton
BorderStyle = bsSizeToolWin
Caption = 'UnitInfoDialog'
ClientHeight = 283
ClientWidth = 500
OnResize = UnitInfoDlgResize
PixelsPerInch = 96
Position = poScreenCenter
HorzScrollBar.Page = 499
VertScrollBar.Page = 282
Left = 349 Left = 349
Height = 283 Height = 283
Top = 244 Top = 244
Width = 500 Width = 500
HorzScrollBar.Page = 499
VertScrollBar.Page = 282
ActiveControl = OkButton
BorderStyle = bsSizeToolWin
Caption = 'UnitInfoDialog'
OnCreate = FormCreate
OnResize = UnitInfoDlgResize
Position = poScreenCenter
object OkButton: TBitBtn object OkButton: TBitBtn
Left = 439
Height = 28
Top = 242
Width = 55
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
Cancel = True Cancel = True
Caption = '&OK' Caption = '&OK'
Default = True Default = True
Kind = bkOK Kind = bkOK
ModalResult = 1 ModalResult = 1
NumGlyphs = 0 NumGlyphs = 0
OnClick = OkButtonClick
TabOrder = 0 TabOrder = 0
Left = 426
Height = 34
Top = 239
Width = 68
end end
object Notebook: TNotebook object Notebook: TNotebook
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
PageIndex = 3
Left = 6 Left = 6
Height = 226 Height = 226
Top = 6 Top = 6
Width = 488 Width = 488
object Page1: TPage Align = alTop
Caption = 'Page1' Anchors = [akTop, akLeft, akRight, akBottom]
ClientWidth = 480 BorderSpacing.Around = 6
ClientHeight = 200 PageIndex = 0
Height = 200 object GeneralPage: TPage
Width = 480 Caption = 'GeneralPage'
object ULines: TLabel object ULines: TLabel
Left = 12
Height = 13
Top = 92
Width = 39
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'ULines' Caption = 'ULines'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 92
Width = 38
end end
object OutLines: TLabel object OutLines: TLabel
AnchorSideLeft.Control = ULines
AnchorSideLeft.Side = asrBottom
Left = 63
Height = 13
Top = 92
Width = 51
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutLines' Caption = 'OutLines'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = ULines
AnchorSideLeft.Side = asrBottom
Left = 62
Height = 14
Top = 92
Width = 43
end end
object OutPath: TLabel object OutPath: TLabel
AnchorSideLeft.Control = UPath
AnchorSideLeft.Side = asrBottom
Left = 58
Height = 13
Top = 112
Width = 46
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutPath' Caption = 'OutPath'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = UPath
AnchorSideLeft.Side = asrBottom
Left = 59
Height = 14
Top = 112
Width = 41
end end
object UPath: TLabel object UPath: TLabel
Left = 12
Height = 13
Top = 112
Width = 34
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'UPath' Caption = 'UPath'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 112
Width = 35
end end
object UIncludedBy: TLabel object UIncludedBy: TLabel
Left = 12
Height = 13
Top = 132
Width = 72
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'UIncludedBy' Caption = 'UIncludedBy'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 132
Width = 72
end end
object OutIncludedBy: TLabel object OutIncludedBy: TLabel
AnchorSideLeft.Control = UIncludedBy
AnchorSideLeft.Side = asrBottom
Left = 96
Height = 13
Top = 132
Width = 84
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutIncludedBy' Caption = 'OutIncludedBy'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = UIncludedBy
AnchorSideLeft.Side = asrBottom
Left = 96
Height = 14
Top = 132
Width = 72
end end
object OutSize: TLabel object OutSize: TLabel
AnchorSideLeft.Control = USize
AnchorSideLeft.Side = asrBottom
Left = 57
Height = 13
Top = 72
Width = 45
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutSize' Caption = 'OutSize'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = USize
AnchorSideLeft.Side = asrBottom
Left = 56
Height = 14
Top = 72
Width = 38
end end
object USize: TLabel object USize: TLabel
Left = 12
Height = 13
Top = 72
Width = 33
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'USize' Caption = 'USize'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 72
Width = 32
end end
object UInProject: TLabel object UInProject: TLabel
Left = 12
Height = 13
Top = 52
Width = 58
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'UInProject' Caption = 'UInProject'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 52
Width = 62
end end
object OutInProject: TLabel object OutInProject: TLabel
AnchorSideLeft.Control = UInProject
AnchorSideLeft.Side = asrBottom
Left = 82
Height = 13
Top = 52
Width = 70
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutInProject' Caption = 'OutInProject'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = UInProject
AnchorSideLeft.Side = asrBottom
Left = 86
Height = 14
Top = 52
Width = 63
end end
object OutType: TLabel object OutType: TLabel
AnchorSideLeft.Control = UType
AnchorSideLeft.Side = asrBottom
Left = 61
Height = 13
Top = 32
Width = 49
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutType' Caption = 'OutType'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = UType
AnchorSideLeft.Side = asrBottom
Left = 61
Height = 14
Top = 32
Width = 43
end end
object UType: TLabel object UType: TLabel
Left = 12
Height = 13
Top = 32
Width = 37
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'UType' Caption = 'UType'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
Left = 12
Height = 14
Top = 32
Width = 37
end end
object OutName: TLabel object OutName: TLabel
AnchorSideLeft.Control = UName
AnchorSideLeft.Side = asrBottom
Left = 65
Height = 13
Top = 12
Width = 53
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = 'OutName' Caption = 'OutName'
Color = clNone Color = clNone
ParentColor = False ParentColor = False
AnchorSideLeft.Control = UName
AnchorSideLeft.Side = asrBottom
Left = 65
Height = 14
Top = 12
Width = 46
end end
object UName: TLabel object UName: TLabel
Left = 12
Height = 13
Top = 12
Width = 41
Alignment = taRightJustify Alignment = taRightJustify
Caption = 'UName' Caption = 'UName'
Color = clNone Color = clNone
Font.Style = [fsBold] Font.Style = [fsBold]
ParentColor = False ParentColor = False
OnResize = UnitInfoDlgResize OnResize = UnitInfoDlgResize
Left = 12
Height = 14
Top = 12
Width = 41
end end
object ClearIncludedBy: TButton object ClearIncludedBy: TButton
AnchorSideTop.Control = UIncludedBy
Left = 12
Height = 26
Top = 152
Width = 107
AutoSize = True AutoSize = True
BorderSpacing.Top = 20 BorderSpacing.Top = 20
BorderSpacing.InnerBorder = 4
Caption = 'ClearIncludedBy' Caption = 'ClearIncludedBy'
OnClick = clearIncludedByClick OnClick = clearIncludedByClick
TabOrder = 0 TabOrder = 0
AnchorSideTop.Control = UIncludedBy
Left = 12
Height = 29
Top = 152
Width = 101
end end
end end
object Page2: TPage object UnitPathsPage: TPage
Caption = 'Page2' Caption = 'UnitPathsPage'
ClientWidth = 480
ClientHeight = 200
Height = 200
Width = 480
object UnitPathMemo: TMemo object UnitPathMemo: TMemo
Left = 6
Height = 184
Top = 6
Width = 472
Align = alClient Align = alClient
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ReadOnly = True ReadOnly = True
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
TabOrder = 0 TabOrder = 0
Left = 6
Height = 188
Top = 6
Width = 468
end end
end end
object Page3: TPage object IncludePathsPage: TPage
Caption = 'Page3' Caption = 'IncludePathsPage'
ClientWidth = 480
ClientHeight = 200
Height = 200
Width = 480
object IncludePathMemo: TMemo object IncludePathMemo: TMemo
Left = 6
Height = 184
Top = 6
Width = 472
Align = alClient Align = alClient
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ReadOnly = True ReadOnly = True
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
TabOrder = 0 TabOrder = 0
Left = 6
Height = 188
Top = 6
Width = 468
end end
end end
object Page4: TPage object CompleteUnitPathsPage: TPage
Caption = 'Page4' Caption = 'CompleteUnitPathsPage'
ClientWidth = 480
ClientHeight = 200
Height = 200
Width = 480
object SrcPathMemo: TMemo object SrcPathMemo: TMemo
Left = 6
Height = 184
Top = 6
Width = 472
Align = alClient Align = alClient
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ReadOnly = True ReadOnly = True
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
TabOrder = 0 TabOrder = 0
Left = 6
Height = 188
Top = 6
Width = 468
end end
end end
end end
object CodeToolsDefsButton: TButton object CodeToolsDefsButton: TButton
Anchors = [akLeft, akBottom] AnchorSideTop.Control = OkButton
AnchorSideBottom.Control = OkButton
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 28
Top = 242
Width = 134
Anchors = [akTop, akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.InnerBorder = 4
Caption = 'CodeToolsDefsButton' Caption = 'CodeToolsDefsButton'
OnClick = CodeToolsDefsButtonClick OnClick = CodeToolsDefsButtonClick
TabOrder = 2 TabOrder = 2
Left = 6 end
Height = 29 object GotoIncludeDirectiveButton: TButton
Top = 239 AnchorSideTop.Control = OkButton
Width = 128 AnchorSideRight.Control = OkButton
AnchorSideBottom.Control = OkButton
AnchorSideBottom.Side = asrBottom
Left = 263
Height = 28
Top = 242
Width = 166
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 10
BorderSpacing.InnerBorder = 4
Caption = 'GotoIncludeDirectiveButton'
ModalResult = 6
OnClick = GotoIncludeDirectiveButtonClick
TabOrder = 3
end end
end end

View File

@ -1,79 +1,87 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TUnitInfoDialog','FORMDATA',[ LazarusResources.Add('TUnitInfoDialog','FORMDATA',[
'TPF0'#15'TUnitInfoDialog'#14'UnitInfoDialog'#13'ActiveControl'#7#8'OkButton' 'TPF0'#15'TUnitInfoDialog'#14'UnitInfoDialog'#4'Left'#3']'#1#6'Height'#3#27#1
+#11'BorderStyle'#7#13'bsSizeToolWin'#7'Caption'#6#14'UnitInfoDialog'#12'Clie' +#3'Top'#3#244#0#5'Width'#3#244#1#18'HorzScrollBar.Page'#3#243#1#18'VertScrol'
+'ntHeight'#3#27#1#11'ClientWidth'#3#244#1#8'OnResize'#7#17'UnitInfoDlgResize' +'lBar.Page'#3#26#1#13'ActiveControl'#7#8'OkButton'#11'BorderStyle'#7#13'bsSi'
+#13'PixelsPerInch'#2'`'#8'Position'#7#14'poScreenCenter'#18'HorzScrollBar.Pa' +'zeToolWin'#7'Caption'#6#14'UnitInfoDialog'#8'OnCreate'#7#10'FormCreate'#8'O'
+'ge'#3#243#1#18'VertScrollBar.Page'#3#26#1#4'Left'#3']'#1#6'Height'#3#27#1#3 +'nResize'#7#17'UnitInfoDlgResize'#8'Position'#7#14'poScreenCenter'#0#7'TBitB'
+'Top'#3#244#0#5'Width'#3#244#1#0#7'TBitBtn'#8'OkButton'#7'Anchors'#11#7'akRi' +'tn'#8'OkButton'#4'Left'#3#183#1#6'Height'#2#28#3'Top'#3#242#0#5'Width'#2'7'
+'ght'#8'akBottom'#0#8'AutoSize'#9#6'Cancel'#9#7'Caption'#6#3'&OK'#7'Default' +#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#6'Cancel'#9#7'Caption'
+#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#0#4 +#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0
+'Left'#3#170#1#6'Height'#2'"'#3'Top'#3#239#0#5'Width'#2'D'#0#0#9'TNotebook'#8 +#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2#0#0#0#9'TNotebook'#8'Notebook'
+'Notebook'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8 +#4'Left'#2#6#6'Height'#3#226#0#3'Top'#2#6#5'Width'#3#232#1#5'Align'#7#5'alTo'
+'akBottom'#0#20'BorderSpacing.Around'#2#6#9'PageIndex'#2#3#4'Left'#2#6#6'Hei' +'p'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpaci'
+'ght'#3#226#0#3'Top'#2#6#5'Width'#3#232#1#0#5'TPage'#5'Page1'#7'Caption'#6#5 +'ng.Around'#2#6#9'PageIndex'#2#0#0#5'TPage'#11'GeneralPage'#7'Caption'#6#11
+'Page1'#11'ClientWidth'#3#224#1#12'ClientHeight'#3#200#0#6'Height'#3#200#0#5 +'GeneralPage'#0#6'TLabel'#6'ULines'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'\'#5
+'Width'#3#224#1#0#6'TLabel'#6'ULines'#9'Alignment'#7#14'taRightJustify'#7'Ca' +'Width'#2''''#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#6'ULines'#5'Col'
+'ption'#6#6'ULines'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'Pa' +'or'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabe'
+'rentColor'#8#4'Left'#2#12#6'Height'#2#14#3'Top'#2'\'#5'Width'#2'&'#0#0#6'TL' +'l'#8'OutLines'#22'AnchorSideLeft.Control'#7#6'ULines'#19'AnchorSideLeft.Sid'
+'abel'#8'OutLines'#18'BorderSpacing.Left'#2#12#7'Caption'#6#8'OutLines'#5'Co' +'e'#7#9'asrBottom'#4'Left'#2'?'#6'Height'#2#13#3'Top'#2'\'#5'Width'#2'3'#18
+'lor'#7#6'clNone'#11'ParentColor'#8#22'AnchorSideLeft.Control'#7#6'ULines'#19 +'BorderSpacing.Left'#2#12#7'Caption'#6#8'OutLines'#5'Color'#7#6'clNone'#11'P'
+'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'>'#6'Height'#2#14#3'Top'#2'\' +'arentColor'#8#0#0#6'TLabel'#7'OutPath'#22'AnchorSideLeft.Control'#7#5'UPath'
+#5'Width'#2'+'#0#0#6'TLabel'#7'OutPath'#18'BorderSpacing.Left'#2#12#7'Captio' +#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2':'#6'Height'#2#13#3'Top'#2
+'n'#6#7'OutPath'#5'Color'#7#6'clNone'#11'ParentColor'#8#22'AnchorSideLeft.Co' +'p'#5'Width'#2'.'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'OutPath'#5'Colo'
+'ntrol'#7#5'UPath'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2';'#6'Hei' +'r'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#5'UPath'#4'Left'#2#12#6'Heig'
+'ght'#2#14#3'Top'#2'p'#5'Width'#2')'#0#0#6'TLabel'#5'UPath'#9'Alignment'#7#14 +'ht'#2#13#3'Top'#2'p'#5'Width'#2'"'#9'Alignment'#7#14'taRightJustify'#7'Capt'
+'taRightJustify'#7'Caption'#6#5'UPath'#5'Color'#7#6'clNone'#10'Font.Style'#11 +'ion'#6#5'UPath'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'Paren'
+#6'fsBold'#0#11'ParentColor'#8#4'Left'#2#12#6'Height'#2#14#3'Top'#2'p'#5'Wid' +'tColor'#8#0#0#6'TLabel'#11'UIncludedBy'#4'Left'#2#12#6'Height'#2#13#3'Top'#3
+'th'#2'#'#0#0#6'TLabel'#11'UIncludedBy'#9'Alignment'#7#14'taRightJustify'#7 +#132#0#5'Width'#2'H'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#11'UIncl'
+'Caption'#6#11'UIncludedBy'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold' +'udedBy'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8
+#0#11'ParentColor'#8#4'Left'#2#12#6'Height'#2#14#3'Top'#3#132#0#5'Width'#2'H' +#0#0#6'TLabel'#13'OutIncludedBy'#22'AnchorSideLeft.Control'#7#11'UIncludedBy'
+#0#0#6'TLabel'#13'OutIncludedBy'#18'BorderSpacing.Left'#2#12#7'Caption'#6#13 +#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'`'#6'Height'#2#13#3'Top'#3
+'OutIncludedBy'#5'Color'#7#6'clNone'#11'ParentColor'#8#22'AnchorSideLeft.Con' +#132#0#5'Width'#2'T'#18'BorderSpacing.Left'#2#12#7'Caption'#6#13'OutIncluded'
+'trol'#7#11'UIncludedBy'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'`' +'By'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#7'OutSize'#22'Anch'
+#6'Height'#2#14#3'Top'#3#132#0#5'Width'#2'H'#0#0#6'TLabel'#7'OutSize'#18'Bor' +'orSideLeft.Control'#7#5'USize'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Lef'
+'derSpacing.Left'#2#12#7'Caption'#6#7'OutSize'#5'Color'#7#6'clNone'#11'Paren' +'t'#2'9'#6'Height'#2#13#3'Top'#2'H'#5'Width'#2'-'#18'BorderSpacing.Left'#2#12
+'tColor'#8#22'AnchorSideLeft.Control'#7#5'USize'#19'AnchorSideLeft.Side'#7#9 +#7'Caption'#6#7'OutSize'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'
+'asrBottom'#4'Left'#2'8'#6'Height'#2#14#3'Top'#2'H'#5'Width'#2'&'#0#0#6'TLab' +#5'USize'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'H'#5'Width'#2'!'#9'Alignment'
+'el'#5'USize'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#5'USize'#5'Colo' +#7#14'taRightJustify'#7'Caption'#6#5'USize'#5'Color'#7#6'clNone'#10'Font.Sty'
+'r'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#4'Left'#2#12 +'le'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#10'UInProject'#4'Left'#2
+#6'Height'#2#14#3'Top'#2'H'#5'Width'#2' '#0#0#6'TLabel'#10'UInProject'#9'Ali' +#12#6'Height'#2#13#3'Top'#2'4'#5'Width'#2':'#9'Alignment'#7#14'taRightJustif'
+'gnment'#7#14'taRightJustify'#7'Caption'#6#10'UInProject'#5'Color'#7#6'clNon' +'y'#7'Caption'#6#10'UInProject'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsB'
+'e'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#4'Left'#2#12#6'Height'#2 +'old'#0#11'ParentColor'#8#0#0#6'TLabel'#12'OutInProject'#22'AnchorSideLeft.C'
+#14#3'Top'#2'4'#5'Width'#2'>'#0#0#6'TLabel'#12'OutInProject'#18'BorderSpacin' +'ontrol'#7#10'UInProject'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'R'
+'g.Left'#2#12#7'Caption'#6#12'OutInProject'#5'Color'#7#6'clNone'#11'ParentCo' +#6'Height'#2#13#3'Top'#2'4'#5'Width'#2'F'#18'BorderSpacing.Left'#2#12#7'Capt'
+'lor'#8#22'AnchorSideLeft.Control'#7#10'UInProject'#19'AnchorSideLeft.Side'#7 +'ion'#6#12'OutInProject'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'
+#9'asrBottom'#4'Left'#2'V'#6'Height'#2#14#3'Top'#2'4'#5'Width'#2'?'#0#0#6'TL' +#7'OutType'#22'AnchorSideLeft.Control'#7#5'UType'#19'AnchorSideLeft.Side'#7#9
+'abel'#7'OutType'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'OutType'#5'Colo' +'asrBottom'#4'Left'#2'='#6'Height'#2#13#3'Top'#2' '#5'Width'#2'1'#18'BorderS'
+'r'#7#6'clNone'#11'ParentColor'#8#22'AnchorSideLeft.Control'#7#5'UType'#19'A' +'pacing.Left'#2#12#7'Caption'#6#7'OutType'#5'Color'#7#6'clNone'#11'ParentCol'
+'nchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'='#6'Height'#2#14#3'Top'#2' '#5 +'or'#8#0#0#6'TLabel'#5'UType'#4'Left'#2#12#6'Height'#2#13#3'Top'#2' '#5'Widt'
+'Width'#2'+'#0#0#6'TLabel'#5'UType'#9'Alignment'#7#14'taRightJustify'#7'Capt' +'h'#2'%'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#5'UType'#5'Color'#7#6
+'ion'#6#5'UType'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'Paren' +'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#7'Out'
+'tColor'#8#4'Left'#2#12#6'Height'#2#14#3'Top'#2' '#5'Width'#2'%'#0#0#6'TLabe' +'Name'#22'AnchorSideLeft.Control'#7#5'UName'#19'AnchorSideLeft.Side'#7#9'asr'
+'l'#7'OutName'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'OutName'#5'Color'#7 +'Bottom'#4'Left'#2'A'#6'Height'#2#13#3'Top'#2#12#5'Width'#2'5'#18'BorderSpac'
+#6'clNone'#11'ParentColor'#8#22'AnchorSideLeft.Control'#7#5'UName'#19'Anchor' +'ing.Left'#2#12#7'Caption'#6#7'OutName'#5'Color'#7#6'clNone'#11'ParentColor'
+'SideLeft.Side'#7#9'asrBottom'#4'Left'#2'A'#6'Height'#2#14#3'Top'#2#12#5'Wid' +#8#0#0#6'TLabel'#5'UName'#4'Left'#2#12#6'Height'#2#13#3'Top'#2#12#5'Width'#2
+'th'#2'.'#0#0#6'TLabel'#5'UName'#9'Alignment'#7#14'taRightJustify'#7'Caption' +')'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#5'UName'#5'Color'#7#6'clN'
+#6#5'UName'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColo' +'one'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#8'OnResize'#7#17'UnitI'
+'r'#8#8'OnResize'#7#17'UnitInfoDlgResize'#4'Left'#2#12#6'Height'#2#14#3'Top' +'nfoDlgResize'#0#0#7'TButton'#15'ClearIncludedBy'#21'AnchorSideTop.Control'#7
+#2#12#5'Width'#2')'#0#0#7'TButton'#15'ClearIncludedBy'#8'AutoSize'#9#17'Bord' +#11'UIncludedBy'#4'Left'#2#12#6'Height'#2#26#3'Top'#3#152#0#5'Width'#2'k'#8
+'erSpacing.Top'#2#20#7'Caption'#6#15'ClearIncludedBy'#7'OnClick'#7#20'clearI' +'AutoSize'#9#17'BorderSpacing.Top'#2#20#25'BorderSpacing.InnerBorder'#2#4#7
+'ncludedByClick'#8'TabOrder'#2#0#21'AnchorSideTop.Control'#7#11'UIncludedBy' +'Caption'#6#15'ClearIncludedBy'#7'OnClick'#7#20'clearIncludedByClick'#8'TabO'
+#4'Left'#2#12#6'Height'#2#29#3'Top'#3#152#0#5'Width'#2'e'#0#0#0#5'TPage'#5'P' +'rder'#2#0#0#0#0#5'TPage'#13'UnitPathsPage'#7'Caption'#6#13'UnitPathsPage'#0
+'age2'#7'Caption'#6#5'Page2'#11'ClientWidth'#3#224#1#12'ClientHeight'#3#200#0 +#5'TMemo'#12'UnitPathMemo'#4'Left'#2#6#6'Height'#3#184#0#3'Top'#2#6#5'Width'
+#6'Height'#3#200#0#5'Width'#3#224#1#0#5'TMemo'#12'UnitPathMemo'#5'Align'#7#8 +#3#216#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9#10
+'alClient'#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ss' +'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#5'TPage'#16'IncludePaths'
+'AutoBoth'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#3#188#0#3'Top'#2#6#5'Width' +'Page'#7'Caption'#6#16'IncludePathsPage'#0#5'TMemo'#15'IncludePathMemo'#4'Le'
,#3#212#1#0#0#0#5'TPage'#5'Page3'#7'Caption'#6#5'Page3'#11'ClientWidth'#3#224 ,'ft'#2#6#6'Height'#3#184#0#3'Top'#2#6#5'Width'#3#216#1#5'Align'#7#8'alClient'
+#1#12'ClientHeight'#3#200#0#6'Height'#3#200#0#5'Width'#3#224#1#0#5'TMemo'#15 +#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8
+'IncludePathMemo'#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#8'Read' +'TabOrder'#2#0#0#0#0#5'TPage'#21'CompleteUnitPathsPage'#7'Caption'#6#21'Comp'
+'Only'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#4'Left'#2#6#6'Heigh' +'leteUnitPathsPage'#0#5'TMemo'#11'SrcPathMemo'#4'Left'#2#6#6'Height'#3#184#0
+'t'#3#188#0#3'Top'#2#6#5'Width'#3#212#1#0#0#0#5'TPage'#5'Page4'#7'Caption'#6 +#3'Top'#2#6#5'Width'#3#216#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'
+#5'Page4'#11'ClientWidth'#3#224#1#12'ClientHeight'#3#200#0#6'Height'#3#200#0 +#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#0#7
+#5'Width'#3#224#1#0#5'TMemo'#11'SrcPathMemo'#5'Align'#7#8'alClient'#20'Borde' +'TButton'#19'CodeToolsDefsButton'#21'AnchorSideTop.Control'#7#8'OkButton'#24
+'rSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrd' +'AnchorSideBottom.Control'#7#8'OkButton'#21'AnchorSideBottom.Side'#7#9'asrBo'
+'er'#2#0#4'Left'#2#6#6'Height'#3#188#0#3'Top'#2#6#5'Width'#3#212#1#0#0#0#0#7 +'ttom'#4'Left'#2#6#6'Height'#2#28#3'Top'#3#242#0#5'Width'#3#134#0#7'Anchors'
+'TButton'#19'CodeToolsDefsButton'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'Au' +#11#5'akTop'#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#25'BorderSpacing.InnerBor'
+'toSize'#9#7'Caption'#6#19'CodeToolsDefsButton'#7'OnClick'#7#24'CodeToolsDef' +'der'#2#4#7'Caption'#6#19'CodeToolsDefsButton'#7'OnClick'#7#24'CodeToolsDefs'
+'sButtonClick'#8'TabOrder'#2#2#4'Left'#2#6#6'Height'#2#29#3'Top'#3#239#0#5'W' +'ButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#26'GotoIncludeDirectiveButton'
+'idth'#3#128#0#0#0#0 +#21'AnchorSideTop.Control'#7#8'OkButton'#23'AnchorSideRight.Control'#7#8'OkB'
+'utton'#24'AnchorSideBottom.Control'#7#8'OkButton'#21'AnchorSideBottom.Side'
+#7#9'asrBottom'#4'Left'#3#7#1#6'Height'#2#28#3'Top'#3#242#0#5'Width'#3#166#0
+#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'#0#8'AutoSize'#9#19'BorderSpac'
+'ing.Right'#2#10#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#26'GotoInclu'
+'deDirectiveButton'#11'ModalResult'#2#6#7'OnClick'#7#31'GotoIncludeDirective'
+'ButtonClick'#8'TabOrder'#2#3#0#0#0
]); ]);

View File

@ -35,6 +35,7 @@ type
{ TUnitInfoDialog } { TUnitInfoDialog }
TUnitInfoDialog = class(TForm) TUnitInfoDialog = class(TForm)
GotoIncludeDirectiveButton: TButton;
CodeToolsDefsButton: TButton; CodeToolsDefsButton: TButton;
OkButton: TBitBtn; OkButton: TBitBtn;
ClearIncludedBy: TButton; ClearIncludedBy: TButton;
@ -49,10 +50,10 @@ type
OutPath: TLabel; OutPath: TLabel;
OutSize: TLabel; OutSize: TLabel;
OutType: TLabel; OutType: TLabel;
Page1: TPage; GeneralPage: TPage;
Page2: TPage; UnitPathsPage: TPage;
Page3: TPage; IncludePathsPage: TPage;
Page4: TPage; CompleteUnitPathsPage: TPage;
PathsGroupBox: TGroupBox; PathsGroupBox: TGroupBox;
UIncludedBy: TLabel; UIncludedBy: TLabel;
UInProject: TLabel; UInProject: TLabel;
@ -62,13 +63,14 @@ type
USize: TLabel; USize: TLabel;
UType: TLabel; UType: TLabel;
procedure CodeToolsDefsButtonClick(Sender: TObject); procedure CodeToolsDefsButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure GotoIncludeDirectiveButtonClick(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure UnitInfoDlgResize(Sender: TObject); procedure UnitInfoDlgResize(Sender: TObject);
procedure clearIncludedByClick(Sender: TObject); procedure clearIncludedByClick(Sender: TObject);
private private
FFilePath: string; FFilePath: string;
function getIncludedBy: string; function getIncludedBy: string;
public
constructor Create(AOwner: TComponent); override;
end; end;
function ShowUnitInfoDlg(const AnUnitName, AType: string; function ShowUnitInfoDlg(const AnUnitName, AType: string;
@ -115,42 +117,17 @@ begin
SrcPathMemo.Lines.Delimiter := ';'; SrcPathMemo.Lines.Delimiter := ';';
SrcPathMemo.Lines.DelimitedText := MinimizeSearchPath(SrcPath); SrcPathMemo.Lines.DelimitedText := MinimizeSearchPath(SrcPath);
Width := Width + 1; GotoIncludeDirectiveButton.Visible:=IncludedBy<>'';
end; end;
Result:=Dlg.ShowModal; Result:=Dlg.ShowModal;
ClearIncludedBy:=(Result=mrOk) and (IncludedBy<>'') and (Dlg.getIncludedBy=''); ClearIncludedBy:=(Result in [mrOk,mrYes]) and (IncludedBy<>'')
and (Dlg.getIncludedBy='');
Dlg.Free; Dlg.Free;
end; end;
{ TUnitInfoDialog } { TUnitInfoDialog }
constructor TUnitInfoDialog.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
//if LazarusResources.Find(ClassName)=nil then
begin
Notebook.Page[0].Caption := 'General';
Notebook.Page[1].Caption := 'Unit paths';
Notebook.Page[2].Caption := 'Include paths';
Notebook.Page[3].Caption := 'Source paths';
Notebook.PageIndex := 0;
UName.Caption:=lisUIDName;
UType.Caption:=lisUIDType;
UInProject.Caption:=lisUIDinProject;
USize.Caption:=lisUIDSize;
ULines.Caption:=lisUIDLines;
UPath.Caption:='Path:';
UIncludedBy.Caption:=lisUIDIncludedBy;
ClearIncludedBy.Caption := lisUIDClear;
CodeToolsDefsButton.Caption:=lisUIShowCodeToolsValues;
end;
UnitInfoDlgResize(nil);
end;
procedure TUnitInfoDialog.UnitInfoDlgResize(Sender: TObject); procedure TUnitInfoDialog.UnitInfoDlgResize(Sender: TObject);
var MaxLength: integer; var MaxLength: integer;
begin begin
@ -188,6 +165,35 @@ begin
ShowCodeToolsDefinesValuesDialog(CodeToolBoss.DefineTree, ExtractFilePath(FFilePath)); ShowCodeToolsDefinesValuesDialog(CodeToolBoss.DefineTree, ExtractFilePath(FFilePath));
end; end;
procedure TUnitInfoDialog.FormCreate(Sender: TObject);
begin
Notebook.Page[0].Caption := lisMenuInsertGeneral;
Notebook.Page[1].Caption := lisUnitPaths;
Notebook.Page[2].Caption := lisIncludePaths;
Notebook.Page[3].Caption := lisSourcePaths;
Notebook.PageIndex := 0;
UName.Caption:=lisUIDName;
UType.Caption:=lisUIDType;
UInProject.Caption:=lisUIDinProject;
USize.Caption:=lisUIDSize;
ULines.Caption:=lisUIDLines;
UPath.Caption:=lisToFPCPath;
UIncludedBy.Caption:=lisUIDIncludedBy;
ClearIncludedBy.Caption := 'Clear included by reference';
CodeToolsDefsButton.Caption:=lisUIShowCodeToolsValues;
end;
procedure TUnitInfoDialog.GotoIncludeDirectiveButtonClick(Sender: TObject);
begin
end;
procedure TUnitInfoDialog.OkButtonClick(Sender: TObject);
begin
end;
procedure TUnitInfoDialog.clearIncludedByClick(Sender: TObject); procedure TUnitInfoDialog.clearIncludedByClick(Sender: TObject);
begin begin
OutIncludedBy.Caption:=''; OutIncludedBy.Caption:='';

View File

@ -106,6 +106,10 @@ type
WithRoot: boolean = true): TLazDockConfigNode; WithRoot: boolean = true): TLazDockConfigNode;
function IndexOf(const AName: string): Integer; function IndexOf(const AName: string): Integer;
function GetScreenBounds: TRect; function GetScreenBounds: TRect;
function FindNeighbour(SiblingSide: TAnchorKind;
NilIfAmbiguous: boolean): TLazDockConfigNode;
function IsTheOnlyNeighbour(Node: TLazDockConfigNode;
SiblingSide: TAnchorKind): boolean;
procedure SaveToConfig(Config: TConfigStorage; const Path: string = ''); procedure SaveToConfig(Config: TConfigStorage; const Path: string = '');
procedure LoadFromConfig(Config: TConfigStorage; const Path: string = ''); procedure LoadFromConfig(Config: TConfigStorage; const Path: string = '');
function GetPath: string; function GetPath: string;
@ -119,7 +123,8 @@ type
property ChildCount: Integer read GetChildCount; property ChildCount: Integer read GetChildCount;
property Childs[Index: integer]: TLazDockConfigNode read GetChilds; default; property Childs[Index: integer]: TLazDockConfigNode read GetChilds; default;
published published
property TheType: TLDConfigNodeType read FTheType write SetTheType default ldcntControl; property TheType: TLDConfigNodeType read FTheType write SetTheType
default ldcntControl;
property Name: string read FName write SetName; property Name: string read FName write SetName;
end; end;
@ -217,6 +222,8 @@ type
function GetLocalizedName: string; function GetLocalizedName: string;
procedure ControlVisibleChanging(Sender: TObject); procedure ControlVisibleChanging(Sender: TObject);
procedure ControlVisibleChanged(Sender: TObject); procedure ControlVisibleChanged(Sender: TObject);
function CreateFormAndDockWithSplitter(Layout: TLazDockConfigNode;
Side: TAnchorKind): boolean;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
procedure ShowDockingEditor; virtual; procedure ShowDockingEditor; virtual;
@ -433,6 +440,39 @@ begin
DumpStack; DumpStack;
end; end;
function TCustomLazControlDocker.CreateFormAndDockWithSplitter(
Layout: TLazDockConfigNode; Side: TAnchorKind): boolean;
{ Add a splitter to Side and dock to it. For example:
----------------+ ----------------------+
-----------+| ------------+#+------+|
Neighbour || -> Neighbour |#| Self ||
-----------+| ------------+#+------+|
----------------+ ----------------------+
If B has no parent, a TLazDockForm is created.
To get space for A, either B is shrinked and/or the parent of B is enlarged
(including the grand parents of B).
}
var
SelfNode: TLazDockConfigNode;
SplitterNode: TLazDockConfigNode;
NeighbourNode: TLazDockConfigNode;
NeighbourControl: TControl;
begin
Result:=false;
SelfNode:=Layout.FindByName(DockerName,true);
SplitterNode:=Layout.FindByName(SelfNode.Sides[Side]);
NeighbourNode:=Layout.FindByName(SplitterNode.Sides[Side]);
NeighbourControl:=Manager.FindControlByDockerName(NeighbourNode.Name);
if NeighbourControl.Parent=nil then begin
end else begin
end;
Result:=true;
end;
function TCustomLazControlDocker.GetControlName(AControl: TControl): string; function TCustomLazControlDocker.GetControlName(AControl: TControl): string;
var var
i: Integer; i: Integer;
@ -782,44 +822,16 @@ var
Result:=Layout.FindByName(ANodeName,true,true); Result:=Layout.FindByName(ANodeName,true,true);
end; end;
function FindNodeUsingSplitter(Splitter: TLazDockConfigNode; function FindControl(const ADockerName: string): TControl;
SiblingSide: TAnchorKind; NilIfAmbiguous: boolean): TLazDockConfigNode;
var
i: Integer;
ParentNode: TLazDockConfigNode;
Child: TLazDockConfigNode;
begin begin
Result:=nil; Result:=Manager.FindControlByDockerName(ADockerName);
ParentNode:=Splitter.Parent;
for i:=0 to ParentNode.ChildCount-1 do begin
Child:=ParentNode.Childs[i];
if CompareText(Child.Sides[SiblingSide],Splitter.Name)=0 then begin
if Result=nil then
Result:=Child
else if NilIfAmbiguous then
exit(nil);
end;
end;
end;
function SplitterIsOnlyUsedByNodeAtSide(Splitter, Node: TLazDockConfigNode;
SiblingSide: TAnchorKind): boolean;
{ check if one side of the Splitter is only used by Node.
For example: If only Node.Sides[SiblingSide]=Splitter.Name
---------+
--+#+---+|
B |#| A ||
--+#+---+|
---------+}
begin
Result:=FindNodeUsingSplitter(Splitter,SiblingSide,true)<>nil;
end; end;
function DockWithOwnSplitter(Side: TAnchorKind): boolean; function DockWithOwnSplitter(Side: TAnchorKind): boolean;
{ Add a splitter to Side and dock to it. For example: { Add a splitter to Side and dock to it. For example:
--------+ -----------+ --------+ -----------+
---+| ----+#+---+| ---+| ----+#+---+|
B | -> B |#| A || B || -> B |#| A ||
---+| ----+#+---+| ---+| ----+#+---+|
--------+ -----------+ --------+ -----------+
If B has no parent, a TLazDockForm is created. If B has no parent, a TLazDockForm is created.
@ -830,11 +842,21 @@ var
var var
SplitterNode: TLazDockConfigNode; SplitterNode: TLazDockConfigNode;
NeighbourNode: TLazDockConfigNode; NeighbourNode: TLazDockConfigNode;
NeighbourControl: TControl;
begin begin
// TODO // TODO
SplitterNode:=FindNode(SelfNode.Sides[Side]); SplitterNode:=FindNode(SelfNode.Sides[Side]);
NeighbourNode:=FindNodeUsingSplitter(SplitterNode,OppositeAnchor[Side],true); NeighbourNode:=SplitterNode.FindNeighbour(OppositeAnchor[Side],true);
if NeighbourNode=nil then ; NeighbourControl:=FindControl(NeighbourNode.Name);
if NeighbourControl=nil then RaiseGDBException('inconsistency');
if NeighbourNode.Parent=nil then begin
// Neighbour is a standalone control
// => combine Neighbour and Self onto a dummy form
Result:=CreateFormAndDockWithSplitter(Layout,Side);
exit;
end else begin
end;
Result:=false; Result:=false;
end; end;
@ -856,7 +878,7 @@ var
if (SideNode<>nil) if (SideNode<>nil)
and (SideNode.TheType in [ldcntSplitterLeftRight,ldcntSplitterUpDown]) and (SideNode.TheType in [ldcntSplitterLeftRight,ldcntSplitterUpDown])
then begin then begin
if SplitterIsOnlyUsedByNodeAtSide(SideNode,SelfNode,a) if SideNode.IsTheOnlyNeighbour(SelfNode,a)
and DockWithOwnSplitter(a) then and DockWithOwnSplitter(a) then
exit(true); exit(true);
inc(SplitterCount); inc(SplitterCount);
@ -1219,39 +1241,6 @@ var
Result:=Root.FindByName(AName,true,true); Result:=Root.FindByName(AName,true,true);
end; end;
function FindNodeUsingSplitter(Splitter: TLazDockConfigNode;
SiblingSide: TAnchorKind; NilIfAmbiguous: boolean): TLazDockConfigNode;
var
i: Integer;
ParentNode: TLazDockConfigNode;
Child: TLazDockConfigNode;
begin
Result:=nil;
ParentNode:=Splitter.Parent;
for i:=0 to ParentNode.ChildCount-1 do begin
Child:=ParentNode.Childs[i];
if CompareText(Child.Sides[SiblingSide],Splitter.Name)=0 then begin
if Result=nil then
Result:=Child
else if NilIfAmbiguous then
exit(nil);
end;
end;
end;
function SplitterIsOnlyUsedByNodeAtSide(Splitter, Node: TLazDockConfigNode;
SiblingSide: TAnchorKind): boolean;
{ check if one side of the Splitter is only used by Node.
For example: If only Node.Sides[SiblingSide]=Splitter.Name
---------+
--+#+---+|
B |#| A ||
--+#+---+|
---------+}
begin
Result:=FindNodeUsingSplitter(Splitter,SiblingSide,true)<>nil;
end;
procedure DeleteNode(var DeletingNode: TLazDockConfigNode); procedure DeleteNode(var DeletingNode: TLazDockConfigNode);
function DeleteOwnSideSplitter(Side: TAnchorKind; function DeleteOwnSideSplitter(Side: TAnchorKind;
@ -1274,7 +1263,7 @@ var
begin begin
Result:=false; Result:=false;
// check if this is the only node using this Side of the splitter // check if this is the only node using this Side of the splitter
if not SplitterIsOnlyUsedByNodeAtSide(SplitterNode,DeletingNode,Side) then if not SplitterNode.IsTheOnlyNeighbour(DeletingNode,Side) then
exit; exit;
// All nodes, that uses the splitter from the other side will now be // All nodes, that uses the splitter from the other side will now be
@ -1562,9 +1551,8 @@ var
if Node.Sides[a]='' then continue; if Node.Sides[a]='' then continue;
SplitterNode:=FindNode(Node.Sides[a]); SplitterNode:=FindNode(Node.Sides[a]);
if (SplitterNode.TheType in [ldcntSplitterLeftRight,ldcntSplitterUpDown]) if (SplitterNode.TheType in [ldcntSplitterLeftRight,ldcntSplitterUpDown])
and SplitterIsOnlyUsedByNodeAtSide(SplitterNode,Node,a) then and SplitterNode.IsTheOnlyNeighbour(Node,a) then begin
begin Result:=SplitterNode.FindNeighbour(OppositeAnchor[a],true);
Result:=FindNodeUsingSplitter(SplitterNode,OppositeAnchor[a],true);
if Result<>nil then exit; if Result<>nil then exit;
end; end;
end; end;
@ -2109,6 +2097,40 @@ begin
Result:=Classes.Bounds(NewLeft,NewTop,NewWidth,NewHeight); Result:=Classes.Bounds(NewLeft,NewTop,NewWidth,NewHeight);
end; end;
function TLazDockConfigNode.FindNeighbour(SiblingSide: TAnchorKind;
NilIfAmbiguous: boolean): TLazDockConfigNode;
var
i: Integer;
ParentNode: TLazDockConfigNode;
Child: TLazDockConfigNode;
begin
Result:=nil;
ParentNode:=Parent;
for i:=0 to ParentNode.ChildCount-1 do begin
Child:=ParentNode.Childs[i];
if Child=Self then continue;
if CompareText(Child.Sides[SiblingSide],Name)=0 then begin
if Result=nil then
Result:=Child
else if NilIfAmbiguous then
exit(nil);
end;
end;
end;
function TLazDockConfigNode.IsTheOnlyNeighbour(Node: TLazDockConfigNode;
SiblingSide: TAnchorKind): boolean;
{ check if one side is only used by Node.
For example: If only Node.Sides[SiblingSide]=Name
---------+
--+#+---+|
B |#| A ||
--+#+---+|
---------+}
begin
Result:=FindNeighbour(SiblingSide,true)<>nil;
end;
procedure TLazDockConfigNode.SaveToConfig(Config: TConfigStorage; procedure TLazDockConfigNode.SaveToConfig(Config: TConfigStorage;
const Path: string); const Path: string);
var var