MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / LoadLayout

Method LoadLayout

Source/Editor/Modules/WindowsModule.cs:276–395  ·  view source on GitHub ↗

Loads the layout from the file. The layout file path. True if layout has been loaded otherwise if failed (e.g. missing file).

(string path)

Source from the content-addressed store, hash-verified

274 /// <param name="path">The layout file path.</param>
275 /// <returns>True if layout has been loaded otherwise if failed (e.g. missing file).</returns>
276 public bool LoadLayout(string path)
277 {
278 if (Editor.IsHeadlessMode)
279 return false;
280
281 Editor.Log(string.Format("Loading editor windows layout from \'{0}\'", path));
282
283 if (!File.Exists(path))
284 {
285 Editor.LogWarning("Cannot load windows layout. File is missing.");
286 return false;
287 }
288
289 XmlDocument doc = new XmlDocument();
290 var masterPanel = Editor.UI.MasterPanel;
291
292 try
293 {
294 doc.Load(path);
295 var root = doc["DockPanelLayout"];
296 if (root == null)
297 {
298 Editor.LogWarning("Invalid windows layout file.");
299 return false;
300 }
301
302 // Reset existing layout
303 masterPanel.ResetLayout();
304
305 // Get metadata
306 int version = int.Parse(root.Attributes["Version"].Value, CultureInfo.InvariantCulture);
307
308 switch (version)
309 {
310 case 4:
311 {
312 // Main window info
313 if (MainWindow)
314 {
315 var mainWindowNode = root["MainWindow"];
316 bool isMaximized = true, isMinimized = false;
317 Rectangle bounds = LoadBounds(mainWindowNode, ref isMaximized, ref isMinimized);
318 LoadWindow(MainWindow, ref bounds, isMaximized, false);
319 }
320
321 // Load master panel structure
322 var masterPanelNode = root["MasterPanel"];
323 if (masterPanelNode != null)
324 {
325 LoadPanel(masterPanelNode, masterPanel);
326 }
327
328 // Load all floating windows structure
329 var floating = root.SelectNodes("Float");
330 if (floating != null)
331 {
332 foreach (XmlElement child in floating)
333 {

Callers 1

Calls 12

FormatMethod · 0.80
ResetLayoutMethod · 0.80
CreateFloatWindowMethod · 0.80
LogMethod · 0.45
ExistsMethod · 0.45
LogWarningMethod · 0.45
LoadMethod · 0.45
ParseMethod · 0.45
CloseMethod · 0.45
PerformLayoutMethod · 0.45
ShowMethod · 0.45
FocusMethod · 0.45

Tested by

no test coverage detected