Merge branch 'Tryibion-editor-options-input'
This commit is contained in:
@@ -23,6 +23,7 @@ namespace FlaxEditor.Windows
|
|||||||
private Tabs _tabs;
|
private Tabs _tabs;
|
||||||
private EditorOptions _options;
|
private EditorOptions _options;
|
||||||
private ToolStripButton _saveButton;
|
private ToolStripButton _saveButton;
|
||||||
|
private readonly Undo _undo;
|
||||||
private readonly List<Tab> _customTabs = new List<Tab>();
|
private readonly List<Tab> _customTabs = new List<Tab>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,6 +34,12 @@ namespace FlaxEditor.Windows
|
|||||||
: base(editor, true, ScrollBars.None)
|
: base(editor, true, ScrollBars.None)
|
||||||
{
|
{
|
||||||
Title = "Editor Options";
|
Title = "Editor Options";
|
||||||
|
|
||||||
|
// Undo
|
||||||
|
_undo = new Undo();
|
||||||
|
_undo.UndoDone += OnUndoRedo;
|
||||||
|
_undo.RedoDone += OnUndoRedo;
|
||||||
|
_undo.ActionDone += OnUndoRedo;
|
||||||
|
|
||||||
var toolstrip = new ToolStrip
|
var toolstrip = new ToolStrip
|
||||||
{
|
{
|
||||||
@@ -58,9 +65,19 @@ namespace FlaxEditor.Windows
|
|||||||
CreateTab("Visual", () => _options.Visual);
|
CreateTab("Visual", () => _options.Visual);
|
||||||
CreateTab("Source Code", () => _options.SourceCode);
|
CreateTab("Source Code", () => _options.SourceCode);
|
||||||
CreateTab("Theme", () => _options.Theme);
|
CreateTab("Theme", () => _options.Theme);
|
||||||
|
|
||||||
|
// Setup input actions
|
||||||
|
InputActions.Add(options => options.Undo, _undo.PerformUndo);
|
||||||
|
InputActions.Add(options => options.Redo, _undo.PerformRedo);
|
||||||
|
InputActions.Add(options => options.Save, SaveData);
|
||||||
|
|
||||||
_tabs.SelectedTabIndex = 0;
|
_tabs.SelectedTabIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnUndoRedo(IUndoAction action)
|
||||||
|
{
|
||||||
|
MarkAsEdited();
|
||||||
|
}
|
||||||
|
|
||||||
private Tab CreateTab(string name, Func<object> getValue)
|
private Tab CreateTab(string name, Func<object> getValue)
|
||||||
{
|
{
|
||||||
@@ -73,7 +90,7 @@ namespace FlaxEditor.Windows
|
|||||||
Parent = tab
|
Parent = tab
|
||||||
};
|
};
|
||||||
|
|
||||||
var settings = new CustomEditorPresenter(null);
|
var settings = new CustomEditorPresenter(_undo);
|
||||||
settings.Panel.Parent = panel;
|
settings.Panel.Parent = panel;
|
||||||
settings.Panel.Tag = getValue;
|
settings.Panel.Tag = getValue;
|
||||||
settings.Modified += MarkAsEdited;
|
settings.Modified += MarkAsEdited;
|
||||||
|
|||||||
Reference in New Issue
Block a user