Cleanup 1
This commit is contained in:
@@ -193,8 +193,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
SortButtons();
|
||||
return item;
|
||||
}
|
||||
@@ -207,8 +209,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, string shortKeys)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text, shortKeys);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text, shortKeys)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
SortButtons();
|
||||
return item;
|
||||
}
|
||||
@@ -221,8 +225,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, Action clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.Clicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -236,8 +242,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, Action<ContextMenuButton> clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.ButtonClicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -252,8 +260,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, string shortKeys, Action clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text, shortKeys);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text, shortKeys)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.Clicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -285,8 +295,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
var item = GetChildMenu(text);
|
||||
if (item == null)
|
||||
{
|
||||
item = new ContextMenuChildMenu(this, text);
|
||||
item.Parent = _panel;
|
||||
item = new ContextMenuChildMenu(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -299,8 +311,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuChildMenu AddChildMenu(string text)
|
||||
{
|
||||
var item = new ContextMenuChildMenu(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuChildMenu(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -310,8 +324,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuSeparator AddSeparator()
|
||||
{
|
||||
var item = new ContextMenuSeparator(this);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuSeparator(this)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,53 +113,71 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
_onClosed = pickerClosed;
|
||||
|
||||
// Selector
|
||||
_cSelector = new ColorSelectorWithSliders(180, 18);
|
||||
_cSelector.Location = new Vector2(PickerMargin, PickerMargin);
|
||||
_cSelector = new ColorSelectorWithSliders(180, 18)
|
||||
{
|
||||
Location = new Vector2(PickerMargin, PickerMargin),
|
||||
Parent = this
|
||||
};
|
||||
_cSelector.ColorChanged += x => SelectedColor = x;
|
||||
_cSelector.Parent = this;
|
||||
|
||||
// Red
|
||||
_cRed = new FloatValueBox(0, _cSelector.Right + PickerMargin + RGBAMargin + ChannelTextWidth, PickerMargin, 100, 0, float.MaxValue, 0.001f);
|
||||
_cRed = new FloatValueBox(0, _cSelector.Right + PickerMargin + RGBAMargin + ChannelTextWidth, PickerMargin, 100, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cRed.ValueChanged += OnRGBAChanged;
|
||||
_cRed.Parent = this;
|
||||
|
||||
// Green
|
||||
_cGreen = new FloatValueBox(0, _cRed.X, _cRed.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cGreen = new FloatValueBox(0, _cRed.X, _cRed.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cGreen.ValueChanged += OnRGBAChanged;
|
||||
_cGreen.Parent = this;
|
||||
|
||||
// Blue
|
||||
_cBlue = new FloatValueBox(0, _cRed.X, _cGreen.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cBlue = new FloatValueBox(0, _cRed.X, _cGreen.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cBlue.ValueChanged += OnRGBAChanged;
|
||||
_cBlue.Parent = this;
|
||||
|
||||
// Alpha
|
||||
_cAlpha = new FloatValueBox(0, _cRed.X, _cBlue.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cAlpha = new FloatValueBox(0, _cRed.X, _cBlue.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cAlpha.ValueChanged += OnRGBAChanged;
|
||||
_cAlpha.Parent = this;
|
||||
|
||||
// Hue
|
||||
_cHue = new FloatValueBox(0, PickerMargin + HSVMargin + ChannelTextWidth, _cSelector.Bottom + PickerMargin, 100, 0, 360);
|
||||
_cHue = new FloatValueBox(0, PickerMargin + HSVMargin + ChannelTextWidth, _cSelector.Bottom + PickerMargin, 100, 0, 360)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cHue.ValueChanged += OnHSVChanged;
|
||||
_cHue.Parent = this;
|
||||
|
||||
// Saturation
|
||||
_cSaturation = new FloatValueBox(0, _cHue.X, _cHue.Bottom + ChannelsMargin, _cHue.Width, 0, 100.0f, 0.1f);
|
||||
_cSaturation = new FloatValueBox(0, _cHue.X, _cHue.Bottom + ChannelsMargin, _cHue.Width, 0, 100.0f, 0.1f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cSaturation.ValueChanged += OnHSVChanged;
|
||||
_cSaturation.Parent = this;
|
||||
|
||||
// Value
|
||||
_cValue = new FloatValueBox(0, _cHue.X, _cSaturation.Bottom + ChannelsMargin, _cHue.Width, 0, float.MaxValue, 0.1f);
|
||||
_cValue = new FloatValueBox(0, _cHue.X, _cSaturation.Bottom + ChannelsMargin, _cHue.Width, 0, float.MaxValue, 0.1f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cValue.ValueChanged += OnHSVChanged;
|
||||
_cValue.Parent = this;
|
||||
|
||||
// Set valid dialog size based on UI content
|
||||
_dialogSize = Size = new Vector2(_cRed.Right + PickerMargin, 300);
|
||||
|
||||
// Hex
|
||||
const float hexTextBoxWidth = 80;
|
||||
_cHex = new TextBox(false, Width - hexTextBoxWidth - PickerMargin, _cSelector.Bottom + PickerMargin, hexTextBoxWidth);
|
||||
_cHex.Parent = this;
|
||||
_cHex = new TextBox(false, Width - hexTextBoxWidth - PickerMargin, _cSelector.Bottom + PickerMargin, hexTextBoxWidth)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cHex.EditEnd += OnHexChanged;
|
||||
|
||||
// Cancel
|
||||
|
||||
@@ -597,8 +597,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
if (_tabsProxy == null)
|
||||
{
|
||||
// Create proxy and make set simple full dock
|
||||
_tabsProxy = new DockPanelProxy(this);
|
||||
_tabsProxy.Parent = this;
|
||||
_tabsProxy = new DockPanelProxy(this)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_tabsProxy.UnlockChildrenRecursive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,8 +496,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
|
||||
private void ShowContextMenu(DockWindow tab, ref Vector2 location)
|
||||
{
|
||||
var menu = new ContextMenu.ContextMenu();
|
||||
menu.Tag = tab;
|
||||
var menu = new ContextMenu.ContextMenu
|
||||
{
|
||||
Tag = tab
|
||||
};
|
||||
tab.OnShowContextMenu(menu);
|
||||
menu.AddButton("Close", OnTabMenuCloseClicked);
|
||||
menu.AddButton("Close All", OnTabMenuCloseAllClicked);
|
||||
|
||||
@@ -41,13 +41,19 @@ namespace FlaxEditor.GUI
|
||||
// Buttons
|
||||
float buttonsWidth = (width - 6.0f) * 0.5f;
|
||||
float buttonsHeight = 20.0f;
|
||||
var revertAll = new Button(2.0f, 2.0f, buttonsWidth, buttonsHeight);
|
||||
revertAll.Text = "Revert All";
|
||||
revertAll.Parent = this;
|
||||
|
||||
var revertAll = new Button(2.0f, 2.0f, buttonsWidth, buttonsHeight)
|
||||
{
|
||||
Text = "Revert All",
|
||||
Parent = this
|
||||
};
|
||||
revertAll.Clicked += OnRevertAllClicked;
|
||||
var applyAll = new Button(revertAll.Right + 2.0f, 2.0f, buttonsWidth, buttonsHeight);
|
||||
applyAll.Text = "Apply All";
|
||||
applyAll.Parent = this;
|
||||
|
||||
var applyAll = new Button(revertAll.Right + 2.0f, 2.0f, buttonsWidth, buttonsHeight)
|
||||
{
|
||||
Text = "Apply All",
|
||||
Parent = this
|
||||
};
|
||||
applyAll.Clicked += OnApplyAllClicked;
|
||||
|
||||
// Actual panel
|
||||
@@ -56,6 +62,7 @@ namespace FlaxEditor.GUI
|
||||
Bounds = new Rectangle(0, applyAll.Bottom + 2.0f, Width, Height - applyAll.Bottom - 2.0f),
|
||||
Parent = this
|
||||
};
|
||||
|
||||
Tree = new Tree.Tree
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||
|
||||
@@ -72,8 +72,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
{
|
||||
var time = stream.ReadSingle();
|
||||
|
||||
var key = new EventKey();
|
||||
key.Parameters = new object[paramsCount];
|
||||
var key = new EventKey
|
||||
{
|
||||
Parameters = new object[paramsCount]
|
||||
};
|
||||
|
||||
for (int j = 0; j < paramsCount; j++)
|
||||
{
|
||||
stream.Read(dataBuffer, 0, e.EventParamsSizes[j]);
|
||||
@@ -316,8 +319,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
}
|
||||
|
||||
// Build default value
|
||||
var defaultValue = new EventKey();
|
||||
defaultValue.Parameters = new object[EventParamsTypes.Length];
|
||||
var defaultValue = new EventKey
|
||||
{
|
||||
Parameters = new object[EventParamsTypes.Length]
|
||||
};
|
||||
|
||||
for (int i = 0; i < EventParamsTypes.Length; i++)
|
||||
defaultValue.Parameters[i] = Activator.CreateInstance(EventParamsTypes[i]);
|
||||
Events.DefaultValue = defaultValue;
|
||||
|
||||
Reference in New Issue
Block a user