Minor improvements to code style #1541
This commit is contained in:
@@ -173,7 +173,7 @@ namespace FlaxEditor.GUI
|
||||
else
|
||||
{
|
||||
// No element selected
|
||||
Render2D.FillRectangle(iconRect, Style.Current.BackgroundNormal);
|
||||
Render2D.FillRectangle(iconRect, style.BackgroundNormal);
|
||||
Render2D.DrawText(style.FontMedium, "No asset\nselected", iconRect, Color.Orange, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace FlaxEditor.GUI
|
||||
rect.Width -= leftDepthMargin;
|
||||
|
||||
Render2D.PushClip(rect);
|
||||
Render2D.DrawText(style.FontMedium, text, rect, Style.Current.Foreground, column.CellAlignment, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, text, rect, style.Foreground, column.CellAlignment, TextAlignment.Center);
|
||||
Render2D.PopClip();
|
||||
|
||||
x += width;
|
||||
|
||||
@@ -627,10 +627,11 @@ namespace FlaxEditor.GUI.Timeline
|
||||
Parent = this
|
||||
};
|
||||
|
||||
var style = Style.Current;
|
||||
var headerTopArea = new ContainerControl
|
||||
{
|
||||
AutoFocus = false,
|
||||
BackgroundColor = Style.Current.LightBackground,
|
||||
BackgroundColor = style.LightBackground,
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||
Offsets = new Margin(0, 0, 0, HeaderTopAreaHeight),
|
||||
Parent = _splitter.Panel1
|
||||
@@ -683,7 +684,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
{
|
||||
AutoFocus = false,
|
||||
ClipChildren = false,
|
||||
BackgroundColor = Style.Current.LightBackground,
|
||||
BackgroundColor = style.LightBackground,
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchBottom,
|
||||
Offsets = new Margin(0, 0, -playbackButtonsSize, playbackButtonsSize),
|
||||
Parent = _splitter.Panel1
|
||||
@@ -845,7 +846,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
_timeIntervalsHeader = new TimeIntervalsHeader(this)
|
||||
{
|
||||
AutoFocus = false,
|
||||
BackgroundColor = Style.Current.Background.RGBMultiplied(0.9f),
|
||||
BackgroundColor = style.Background.RGBMultiplied(0.9f),
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||
Offsets = new Margin(0, 0, 0, HeaderTopAreaHeight),
|
||||
Parent = _splitter.Panel2
|
||||
@@ -854,7 +855,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
{
|
||||
AutoFocus = false,
|
||||
ClipChildren = false,
|
||||
BackgroundColor = Style.Current.Background.RGBMultiplied(0.7f),
|
||||
BackgroundColor = style.Background.RGBMultiplied(0.7f),
|
||||
AnchorPreset = AnchorPresets.StretchAll,
|
||||
Offsets = new Margin(0, 0, HeaderTopAreaHeight, 0),
|
||||
Parent = _splitter.Panel2
|
||||
|
||||
@@ -208,13 +208,13 @@ namespace FlaxEditor.Options
|
||||
|
||||
// If a non-default style was chosen, switch to that style
|
||||
string styleName = themeOptions.SelectedStyle;
|
||||
if (styleName != "Default" && styleName != "LightDefault" && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null)
|
||||
if (styleName != ThemeOptions.DefaultName && styleName != ThemeOptions.LightDefault && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null)
|
||||
{
|
||||
Style.Current = style;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (styleName == "LightDefault")
|
||||
if (styleName == ThemeOptions.LightDefault)
|
||||
{
|
||||
Style.Current = CreateLightStyle();
|
||||
}
|
||||
@@ -231,7 +231,6 @@ namespace FlaxEditor.Options
|
||||
/// <returns>The style object.</returns>
|
||||
public Style CreateDefaultStyle()
|
||||
{
|
||||
// Metro Style colors
|
||||
var options = Options;
|
||||
var style = new Style
|
||||
{
|
||||
@@ -282,7 +281,6 @@ namespace FlaxEditor.Options
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
style.DragWindow = style.BackgroundSelected * 0.7f;
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
@@ -292,7 +290,6 @@ namespace FlaxEditor.Options
|
||||
/// <returns>The style object.</returns>
|
||||
public Style CreateLightStyle()
|
||||
{
|
||||
// Metro Style colors
|
||||
var options = Options;
|
||||
var style = new Style
|
||||
{
|
||||
@@ -334,9 +331,8 @@ namespace FlaxEditor.Options
|
||||
Scale = Editor.Icons.Scale32,
|
||||
Scalar = Editor.Icons.Scalar32,
|
||||
|
||||
SharedTooltip = new Tooltip()
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Options
|
||||
[CustomEditor(typeof(ThemeOptionsEditor))]
|
||||
public sealed class ThemeOptions
|
||||
{
|
||||
internal const string DefaultName = "Default";
|
||||
internal const string LightDefault = "LightDefault";
|
||||
|
||||
internal class ThemeOptionsEditor : Editor<ThemeOptions>
|
||||
{
|
||||
private LabelElement _infoLabel;
|
||||
@@ -64,8 +67,8 @@ namespace FlaxEditor.Options
|
||||
{
|
||||
var themeOptions = (ThemeOptions)ParentEditor.Values[0];
|
||||
var options = new string[themeOptions.Styles.Count + 2];
|
||||
options[0] = "Default";
|
||||
options[1] = "LightDefault";
|
||||
options[0] = DefaultName;
|
||||
options[1] = LightDefault;
|
||||
|
||||
int i = 0;
|
||||
foreach (var styleName in themeOptions.Styles.Keys)
|
||||
|
||||
@@ -62,8 +62,9 @@ namespace FlaxEditor.Windows.Profiler
|
||||
_memoryUsageChart.SelectedSampleChanged += OnSelectedSampleChanged;
|
||||
|
||||
// Table
|
||||
var headerColor = Style.Current.LightBackground;
|
||||
var textColor = Style.Current.Foreground;
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
var textColor = style.Foreground;
|
||||
_table = new Table
|
||||
{
|
||||
Columns = new[]
|
||||
|
||||
@@ -92,8 +92,9 @@ namespace FlaxEditor.Windows.Profiler
|
||||
};
|
||||
|
||||
// Table
|
||||
var headerColor = Style.Current.LightBackground;
|
||||
var textColor = Style.Current.Foreground;
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
var textColor = style.Foreground;
|
||||
_table = new Table
|
||||
{
|
||||
Columns = new[]
|
||||
|
||||
@@ -63,8 +63,9 @@ namespace FlaxEditor.Windows.Profiler
|
||||
};
|
||||
|
||||
// Table
|
||||
var headerColor = Style.Current.LightBackground;
|
||||
var textColor = Style.Current.Foreground;
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
var textColor = style.Foreground;
|
||||
_table = new Table
|
||||
{
|
||||
Columns = new[]
|
||||
|
||||
@@ -63,8 +63,9 @@ namespace FlaxEditor.Windows.Profiler
|
||||
_memoryUsageChart.SelectedSampleChanged += OnSelectedSampleChanged;
|
||||
|
||||
// Table
|
||||
var headerColor = Style.Current.LightBackground;
|
||||
var textColor = Style.Current.Foreground;
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
var textColor = style.Foreground;
|
||||
_table = new Table
|
||||
{
|
||||
Columns = new[]
|
||||
|
||||
@@ -252,8 +252,9 @@ namespace FlaxEditor.Windows.Profiler
|
||||
|
||||
private static Table InitTable(ContainerControl parent, string name)
|
||||
{
|
||||
var headerColor = Style.Current.LightBackground;
|
||||
var textColor = Style.Current.Foreground;
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
var textColor = style.Foreground;
|
||||
var table = new Table
|
||||
{
|
||||
Columns = new[]
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace FlaxEditor.Windows.Profiler
|
||||
if (_selectedSampleIndex != -1)
|
||||
{
|
||||
float selectedX = Width - (_samples.Count - _selectedSampleIndex - 1) * PointsOffset;
|
||||
Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), Style.Current.Foreground, 1.5f);
|
||||
Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), style.Foreground, 1.5f);
|
||||
}
|
||||
|
||||
int samplesInViewCount = Math.Min((int)(Width / PointsOffset), _samples.Count) - 1;
|
||||
@@ -138,8 +138,8 @@ namespace FlaxEditor.Windows.Profiler
|
||||
var headerRect = new Rectangle(0, chartHeight, Width, TitleHeight);
|
||||
var headerTextRect = new Rectangle(2, chartHeight, Width - 4, TitleHeight);
|
||||
Render2D.FillRectangle(headerRect, style.BackgroundNormal);
|
||||
Render2D.DrawText(style.FontMedium, Title, headerTextRect, Style.Current.ForegroundGrey, TextAlignment.Near, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, _sample, headerTextRect, Style.Current.Foreground, TextAlignment.Far, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, Title, headerTextRect, style.ForegroundGrey, TextAlignment.Near, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, _sample, headerTextRect, style.Foreground, TextAlignment.Far, TextAlignment.Center);
|
||||
}
|
||||
|
||||
private void OnClick(ref Float2 location)
|
||||
|
||||
Reference in New Issue
Block a user