anchordocking: fix broken default layout. issue #29863 and #31084. Patch by Michl

git-svn-id: trunk@53592 -
This commit is contained in:
ondrej 2016-12-07 21:40:55 +00:00
parent f7d8ccb996
commit 7d0f452c5b
4 changed files with 127 additions and 25 deletions

1
.gitattributes vendored
View File

@ -605,6 +605,7 @@ components/anchordocking/anchordockoptionsdlg.pas svneol=native#text/plain
components/anchordocking/anchordockpkg.pas svneol=native#text/plain
components/anchordocking/anchordockstorage.pas svneol=native#text/plain
components/anchordocking/anchordockstr.pas svneol=native#text/plain
components/anchordocking/design/ADLayoutDefault.lrs svneol=native#text/pascal
components/anchordocking/design/ADLayoutDefault.xml svneol=native#text/plain
components/anchordocking/design/anchordesktopoptions.pas svneol=native#text/pascal
components/anchordocking/design/anchordockingdsgn.lpk svneol=native#text/plain

View File

@ -0,0 +1,51 @@
LazarusResources.Add('ADLayoutDefault','XML',[
'<?xml version="1.0"?>'#13#10'<CONFIG>'#13#10' <MainConfig>'#13#10' <Node'
+'s ChildCount="1">'#13#10' <Item1 Name="MainIDE" Type="CustomSite" Chil'
+'dCount="1">'#13#10' <Bounds Width="1024" Height="768">'#13#10' '
+' <WorkArea>'#13#10' <Rect Right="1920" Bottom="1036"/>'#13#10
+' </WorkArea>'#13#10' </Bounds>'#13#10' <Item1 Name="'
+'AnchorDockSite10" Type="Layout" ChildCount="7">'#13#10' <Bounds To'
+'p="60" Width="1024" Height="688" SplitterPos="58"/>'#13#10' <Ancho'
+'rs Align="Bottom"/>'#13#10' <Item1 Name="SourceNotebook" Type="Con'
+'trol">'#13#10' <Bounds Left="177" Width="651" Height="505"/>'#13
+#10' <Anchors Left="AnchorDockSplitter4" Right="AnchorDockSplitte'
+'r3" Bottom="AnchorDockSplitter2"/>'#13#10' <Header Position="lef'
+'t"/>'#13#10' </Item1>'#13#10' <Item2 Name="AnchorDockSpli'
+'tter2" Type="SplitterHorizontal">'#13#10' <Bounds Left="177" Top'
+'="505" Width="651" Height="7"/>'#13#10' <Anchors Left="AnchorDoc'
+'kSplitter4" Right="AnchorDockSplitter3"/>'#13#10' </Item2>'#13#10
+' <Item3 Name="AnchorDockSite11" Type="Pages" ChildCount="5">'#13#10
+' <Bounds Left="177" Top="512" Width="651" Height="176"/>'#13#10
+' <Anchors Left="AnchorDockSplitter4" Top="AnchorDockSplitter2" R'
+'ight="AnchorDockSplitter3"/>'#13#10' <Item1 Name="MessagesView" '
+'Type="Control">'#13#10' <Bounds Width="643" Height="150"/>'#13
+#10' <Anchors Align="Client"/>'#13#10' </Item1>'#13
+#10' <Item2 Name="Watches" Type="Control">'#13#10' <'
+'Bounds Width="932" Height="119"/>'#13#10' <Anchors Align="Clie'
+'nt"/>'#13#10' </Item2>'#13#10' <Item3 Name="SearchRes'
+'ults" Type="Control">'#13#10' <Bounds Width="932" Height="119"'
+'/>'#13#10' <Anchors Align="Client"/>'#13#10' </Item'
+'3>'#13#10' <Item4 Name="Assembler" Type="Control">'#13#10' '
+' <Bounds Width="932" Height="106"/>'#13#10' <Anchors Al'
+'ign="Client"/>'#13#10' </Item4>'#13#10' <Item5 Name="'
+'BreakPoints" Type="Control">'#13#10' <Bounds Width="937" Heigh'
+'t="106"/>'#13#10' <Anchors Align="Client"/>'#13#10' '
+' </Item5>'#13#10' </Item3>'#13#10' <Item4 Name="AnchorDoc'
+'kSplitter3" Type="SplitterVertical">'#13#10' <Bounds Left="828" '
+'Width="9" Height="688"/>'#13#10' </Item4>'#13#10' <Item5 '
+'Name="AnchorDockSite12" Type="Pages" ChildCount="2">'#13#10' <Bo'
+'unds Left="837" Width="187" Height="688"/>'#13#10' <Anchors Left'
+'="AnchorDockSplitter3"/>'#13#10' <Item1 Name="CodeExplorerView" '
+'Type="Control">'#13#10' <Bounds Width="179" Height="662"/>'#13
+#10' <Anchors Align="Client"/>'#13#10' </Item1>'#13
+#10' <Item2 Name="ComponentList" Type="Control">'#13#10' '
+' <Bounds Width="159" Height="626"/>'#13#10' <Anchors Align'
+'="Client"/>'#13#10' </Item2>'#13#10' </Item5>'#13#10' '
+' <Item6 Name="ObjectInspectorDlg" Type="Control">'#13#10' '
+' <Bounds Width="173" Height="688"/>'#13#10' <Anchors Right="Anch'
+'orDockSplitter4"/>'#13#10' </Item6>'#13#10' <Item7 Name="'
+'AnchorDockSplitter4" Type="SplitterVertical">'#13#10' <Bounds Le'
+'ft="173" Width="4" Height="688"/>'#13#10' </Item7>'#13#10' '
+'</Item1>'#13#10' </Item1>'#13#10' </Nodes>'#13#10' </MainConfig>'
+#13#10'</CONFIG>'#13#10
]);

View File

@ -3,34 +3,69 @@
<MainConfig>
<Nodes ChildCount="1">
<Item1 Name="MainIDE" Type="CustomSite" ChildCount="1">
<Bounds Top="28" Left="15" Width="614" Height="429">
<Bounds Width="1024" Height="768">
<WorkArea>
<Rect Top="25" Right="800" Bottom="600"/>
<Rect Right="1920" Bottom="1036"/>
</WorkArea>
</Bounds>
<Item1 Name="AnchorDockSite5" Type="Layout" ChildCount="5">
<Bounds Top="65" Width="614" Height="339" SplitterPos="61"/>
<Item1 Name="AnchorDockSite10" Type="Layout" ChildCount="7">
<Bounds Top="60" Width="1024" Height="688" SplitterPos="58"/>
<Anchors Align="Bottom"/>
<Item1 Name="SourceNotebook" Type="Control">
<Bounds Width="468" Height="264"/>
<Anchors Right="AnchorDockSplitter3" Bottom="AnchorDockSplitter2"/>
<Bounds Left="177" Width="651" Height="505"/>
<Anchors Left="AnchorDockSplitter4" Right="AnchorDockSplitter3" Bottom="AnchorDockSplitter2"/>
<Header Position="left"/>
</Item1>
<Item2 Name="AnchorDockSplitter2" Type="SplitterHorizontal">
<Bounds Top="264" Width="468" Height="4"/>
<Anchors Right="AnchorDockSplitter3"/>
<Bounds Left="177" Top="505" Width="651" Height="7"/>
<Anchors Left="AnchorDockSplitter4" Right="AnchorDockSplitter3"/>
</Item2>
<Item3 Name="MessagesView" Type="Control">
<Bounds Top="268" Width="468" Height="71"/>
<Anchors Top="AnchorDockSplitter2" Right="AnchorDockSplitter3"/>
<Item3 Name="AnchorDockSite11" Type="Pages" ChildCount="5">
<Bounds Left="177" Top="512" Width="651" Height="176"/>
<Anchors Left="AnchorDockSplitter4" Top="AnchorDockSplitter2" Right="AnchorDockSplitter3"/>
<Item1 Name="MessagesView" Type="Control">
<Bounds Width="643" Height="150"/>
<Anchors Align="Client"/>
</Item1>
<Item2 Name="Watches" Type="Control">
<Bounds Width="932" Height="119"/>
<Anchors Align="Client"/>
</Item2>
<Item3 Name="SearchResults" Type="Control">
<Bounds Width="932" Height="119"/>
<Anchors Align="Client"/>
</Item3>
<Item4 Name="Assembler" Type="Control">
<Bounds Width="932" Height="106"/>
<Anchors Align="Client"/>
</Item4>
<Item5 Name="BreakPoints" Type="Control">
<Bounds Width="937" Height="106"/>
<Anchors Align="Client"/>
</Item5>
</Item3>
<Item4 Name="AnchorDockSplitter3" Type="SplitterVertical">
<Bounds Left="468" Width="4" Height="339"/>
<Bounds Left="828" Width="9" Height="688"/>
</Item4>
<Item5 Name="CodeExplorerView" Type="Control">
<Bounds Left="472" Width="142" Height="339"/>
<Item5 Name="AnchorDockSite12" Type="Pages" ChildCount="2">
<Bounds Left="837" Width="187" Height="688"/>
<Anchors Left="AnchorDockSplitter3"/>
<Item1 Name="CodeExplorerView" Type="Control">
<Bounds Width="179" Height="662"/>
<Anchors Align="Client"/>
</Item1>
<Item2 Name="ComponentList" Type="Control">
<Bounds Width="159" Height="626"/>
<Anchors Align="Client"/>
</Item2>
</Item5>
<Item6 Name="ObjectInspectorDlg" Type="Control">
<Bounds Width="173" Height="688"/>
<Anchors Right="AnchorDockSplitter4"/>
</Item6>
<Item7 Name="AnchorDockSplitter4" Type="SplitterVertical">
<Bounds Left="173" Width="4" Height="688"/>
</Item7>
</Item1>
</Item1>
</Nodes>

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
LCLProc, Forms, Controls,
LCLProc, Forms, Controls, LCLType, LResources,
LazFileUtils, LazConfigStorage, Laz2_XMLCfg,
IDEOptionsIntf, MacroIntf, LazIDEIntf, BaseIDEIntf,
AnchorDocking, AnchorDockStorage;
@ -29,6 +29,7 @@ type
procedure LoadLegacyAnchorDockOptions;
procedure LoadLayoutFromConfig(Path: string; aXMLCfg: TRttiXMLConfig);
procedure LoadLayoutFromFile(FileName: string);
procedure LoadLayoutFromRessource;
procedure SaveMainLayoutToTree;
procedure SaveLayoutToConfig(Path: string; aXMLCfg: TRttiXMLConfig);
@ -118,22 +119,13 @@ end;
procedure TAnchorDesktopOpt.LoadDefaultLayout;
var
BaseDir: String;
Filename: String;
begin
Filename := AppendPathDelim(LazarusIDE.GetPrimaryConfigPath)+'anchordocklayout.xml';
if FileExistsUTF8(Filename) then//first load from anchordocklayout.xml -- backwards compatibility
LoadLayoutFromFile(Filename)
else
begin
BaseDir := '$PkgDir(AnchorDockingDsgn)';
IDEMacros.SubstituteMacros(BaseDir);
if (BaseDir<>'') and DirectoryExistsUTF8(BaseDir) then begin
Filename:=AppendPathDelim(BaseDir)+'ADLayoutDefault.xml';
if FileExistsUTF8(Filename) then
LoadLayoutFromFile(Filename);
end;
end;
LoadLayoutFromRessource;
end;
procedure TAnchorDesktopOpt.LoadDefaults;
@ -175,6 +167,25 @@ begin
end;
end;
procedure TAnchorDesktopOpt.LoadLayoutFromRessource;
var
Config: TRttiXMLConfig;
LayoutResource: TLazarusResourceStream;
begin
LayoutResource := TLazarusResourceStream.Create('ADLayoutDefault', nil);
try
Config := TRttiXMLConfig.Create(nil);
try
Config.ReadFromStream(LayoutResource);
LoadLayoutFromConfig('',Config);
finally
Config.Free;
end;
finally
LayoutResource.Free;
end;
end;
procedure TAnchorDesktopOpt.LoadLegacyAnchorDockOptions;
var
Config: TConfigStorage;
@ -282,5 +293,9 @@ begin
Result := DockMaster.FullRestoreLayout(FTree,True);
end;
initialization
{$I ADLayoutDefault.lrs}
end.