Esempio n. 1
0
        private static void SetConfiguration(TableSplitControl control, ViewportWindowConfiguration configuration)
        {
            if (control == null || configuration == null)
            {
                return;
            }

            control.Configuration = configuration.Configuration;
            var viewports = GetViewportsForTableSplitControl(control);

            control.Controls.Clear();
            foreach (var vp in viewports)
            {
                vp.Dispose();
                Viewports.Remove(vp);
            }

            LoadViewports(control, configuration);
        }
Esempio n. 2
0
        public static void Init(TableSplitControl tlp)
        {
            MainWindowGrid = tlp;

            var configuration = SettingsManager.GetAdditionalData <List <ViewportWindowConfiguration> >("ViewportManagerWindowConfiguration")
                                ?? new List <ViewportWindowConfiguration>();
            var main = configuration.FirstOrDefault(x => x.WindowID == 0) ?? GetDefaultWindowConfiguration();

            MainWindowGrid.Configuration = main.Configuration;
            LoadViewports(MainWindowGrid, main);
            if (!main.Size.IsEmpty)
            {
                Editor.Instance.Location    = main.Size.Location;
                Editor.Instance.Size        = main.Size.Size;
                Editor.Instance.WindowState = main.Maximised ? FormWindowState.Maximized : FormWindowState.Normal;
            }

            foreach (var config in configuration.Where(x => x.WindowID > 0))
            {
                CreateViewportWindow(config);
            }
        }
Esempio n. 3
0
        private static void LoadViewports(TableSplitControl tableSplitControl, ViewportWindowConfiguration config)
        {
            var defaultViewports = new[]
            {
                Tuple.Create(true, Viewport3D.ViewType.Lightmapped, Viewport2D.ViewDirection.Top),
                Tuple.Create(false, Viewport3D.ViewType.Lightmapped, Viewport2D.ViewDirection.Top),
                Tuple.Create(false, Viewport3D.ViewType.Lightmapped, Viewport2D.ViewDirection.Front),
                Tuple.Create(false, Viewport3D.ViewType.Lightmapped, Viewport2D.ViewDirection.Side)
            };

            var viewports = config.Viewports ?? new List <string>();

            for (int i = 0; i < config.Configuration.Rectangles.Count; i++)
            {
                var viewport = viewports.Count > i ? viewports[i] : "";
                var def      = defaultViewports[(i % defaultViewports.Length)];
                var vp       = CreateViewport(viewport, def.Item1, def.Item2, def.Item3);
                Viewports.Add(vp);
                SubscribeExceptions(vp);
                tableSplitControl.Controls.Add(vp);
                Mediator.Publish(EditorMediator.ViewportCreated, vp);
                vp.Run();
            }
        }
Esempio n. 4
0
 private static IEnumerable <ViewportBase> GetViewportsForTableSplitControl(TableSplitControl control)
 {
     return(Viewports.Where(x => GetParentSplitControl(x) == control));
 }