Beispiel #1
0
        private void EditorLoad(object sender, EventArgs e)
        {
            FileTypeRegistration.RegisterFileTypes();

            SettingsManager.Read();

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.ApplicationId = FileTypeRegistration.ProgramId;

                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                _jumpList.Refresh();
            }

            UpdateDocumentTabs();
            UpdateRecentFiles();

            DockBottom.Hidden = DockLeft.Hidden = DockRight.Hidden = true;

            MenuManager.Init(mnuMain, tscToolStrip);
            MenuManager.Rebuild();

            SidebarManager.Init(RightSidebar);

            ViewportManager.Init(TableSplitView);
            ToolManager.Init();

            foreach (var tool in ToolManager.Tools)
            {
                var tl     = tool;
                var hotkey = Sledge.Settings.Hotkeys.GetHotkeyForMessage(HotkeysMediator.SwitchTool, tool.GetHotkeyToolType());
                tspTools.Items.Add(new ToolStripButton(
                                       "",
                                       tl.GetIcon(),
                                       (s, ea) => Mediator.Publish(HotkeysMediator.SwitchTool, tl.GetHotkeyToolType()),
                                       tl.GetName())
                {
                    Checked      = (tl == ToolManager.ActiveTool),
                    ToolTipText  = tl.GetName() + (hotkey != null ? " (" + hotkey.Hotkey + ")" : ""),
                    DisplayStyle = ToolStripItemDisplayStyle.Image,
                    ImageScaling = ToolStripItemImageScaling.None,
                    AutoSize     = false,
                    Width        = 36,
                    Height       = 36
                }
                                   );
            }

            TextureProvider.SetCachePath(SettingsManager.GetTextureCachePath());
            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new MapFormatProvider());
            MapProvider.Register(new VmfProvider());
            MapProvider.Register(new ObjProvider());
            GameDataProvider.Register(new FgdProvider());
            TextureProvider.Register(new WadProvider());
            TextureProvider.Register(new SprProvider());
            TextureProvider.Register(new VmtProvider());
            ModelProvider.Register(new MdlProvider());

            WadProvider.ReplaceTransparentPixels   = !Sledge.Settings.View.DisableWadTransparency && !Sledge.Settings.View.GloballyDisableTransparency;
            TextureHelper.EnableTransparency       = !Sledge.Settings.View.GloballyDisableTransparency;
            TextureHelper.DisableTextureFiltering  = Sledge.Settings.View.DisableTextureFiltering;
            TextureHelper.ForceNonPowerOfTwoResize = Sledge.Settings.View.ForcePowerOfTwoTextureResizing;

            Subscribe();

            Mediator.MediatorException += (mthd, ex) => Logging.Logger.ShowException(ex.Exception, "Mediator Error: " + ex.Message);

            if (Sledge.Settings.View.LoadSession)
            {
                foreach (var session in SettingsManager.LoadSession())
                {
                    LoadFileGame(session.Item1, session.Item2);
                }
            }

            ProcessArguments(System.Environment.GetCommandLineArgs());
        }