// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
using System.Collections.Generic;
using FlaxEditor.CustomEditors;
using FlaxEditor.GUI;
using FlaxEditor.GUI.Tabs;
using FlaxEditor.Options;
using FlaxEngine;
using FlaxEngine.GUI;
using FlaxEngine.Json;
using FlaxEngine.Utilities;
namespace FlaxEditor.Windows
{
///
/// Editor window for changing the options.
///
///
public sealed class EditorOptionsWindow : EditorWindow
{
private bool _isDataDirty;
private Tabs _tabs;
private EditorOptions _options;
private ToolStripButton _saveButton;
private readonly List _customTabs = new List();
///
/// Initializes a new instance of the class.
///
/// The editor.
public EditorOptionsWindow(Editor editor)
: base(editor, true, ScrollBars.None)
{
Title = "Editor Options";
var toolstrip = new ToolStrip
{
Parent = this
};
_saveButton = (ToolStripButton)toolstrip.AddButton(editor.Icons.Save64, SaveData).LinkTooltip("Save");
_saveButton.Enabled = false;
_tabs = new Tabs
{
Orientation = Orientation.Vertical,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, toolstrip.Bottom, 0),
TabsSize = new Float2(120, 32),
UseScroll = true,
Parent = this
};
CreateTab("General", () => _options.General);
CreateTab("Interface", () => _options.Interface);
CreateTab("Input", () => _options.Input);
CreateTab("Viewport", () => _options.Viewport);
CreateTab("Visual", () => _options.Visual);
CreateTab("Source Code", () => _options.SourceCode);
CreateTab("Theme", () => _options.Theme);
_tabs.SelectedTabIndex = 0;
}
private Tab CreateTab(string name, Func