@@ -195,7 +195,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
filesCount += files.Length;
|
||||
foreach (var file in files)
|
||||
FindNewKeysCpp(file, newKeys, allKeys);
|
||||
files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray();;
|
||||
files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray();
|
||||
filesCount += files.Length;
|
||||
foreach (var file in files)
|
||||
FindNewKeysCpp(file, newKeys, allKeys);
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
_window.GotFocus += OnWindowGotFocus;
|
||||
_window.LostFocus += OnWindowLostFocus;
|
||||
}
|
||||
|
||||
|
||||
#if USE_IS_FOREGROUND && USE_SDL_WORKAROUNDS
|
||||
// The focus between popup and parent windows doesn't change, force hide the popup when clicked on parent
|
||||
parentWin.Window.MouseDown += OnWindowMouseDown;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// The mouse position.
|
||||
/// </summary>
|
||||
public Float2 MousePosition = Float2.Minimum;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The mouse position.
|
||||
/// </summary>
|
||||
|
||||
@@ -193,6 +193,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
CreateFloating(Float2.Zero, Float2.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the window in a floating state.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,13 +14,13 @@ namespace FlaxEditor.GUI.Docking
|
||||
private class FloatWindowDecorations : WindowDecorations
|
||||
{
|
||||
private FloatWindowDockPanel _panel;
|
||||
|
||||
|
||||
public FloatWindowDecorations(FloatWindowDockPanel panel)
|
||||
: base(panel.RootWindow)
|
||||
{
|
||||
_panel = panel;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -76,19 +76,19 @@ namespace FlaxEditor.GUI.Docking
|
||||
Parent = window;
|
||||
_window.Window.Closing += OnClosing;
|
||||
_window.Window.LeftButtonHit += OnLeftButtonHit;
|
||||
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations())
|
||||
{
|
||||
var decorations = Parent.AddChild(new FloatWindowDecorations(this));
|
||||
decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void PerformLayoutBeforeChildren()
|
||||
{
|
||||
base.PerformLayoutBeforeChildren();
|
||||
|
||||
|
||||
var decorations = Parent.GetChild<FloatWindowDecorations>();
|
||||
if (decorations != null)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
settings.ShowAfterFirstPaint = false;
|
||||
settings.ShowInTaskbar = true;
|
||||
settings.StartPosition = startPosition;
|
||||
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations())
|
||||
{
|
||||
settings.HasBorder = false;
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace FlaxEditor.GUI.Input
|
||||
#else
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMoveRelative(Float2 mouseMotion)
|
||||
public override void OnMouseMoveRelative(Float2 motion)
|
||||
{
|
||||
var location = Root.TrackingMouseOffset;
|
||||
if (_isSliding)
|
||||
@@ -344,7 +344,7 @@ namespace FlaxEditor.GUI.Input
|
||||
_cursorChanged = false;
|
||||
}
|
||||
|
||||
base.OnMouseMoveRelative(mouseMotion);
|
||||
base.OnMouseMoveRelative(motion);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.Options;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -26,12 +23,12 @@ public class WindowDecorations : ContainerControl
|
||||
/// The title label in the title bar.
|
||||
/// </summary>
|
||||
public Label Title => _title;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The icon used in the title bar.
|
||||
/// </summary>
|
||||
public Image Icon => _icon;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The tooltip shown when hovering over the icon.
|
||||
/// </summary>
|
||||
@@ -54,7 +51,7 @@ public class WindowDecorations : ContainerControl
|
||||
: base(0, 0, 0, 20)
|
||||
{
|
||||
_window = window.RootWindow.Window;
|
||||
|
||||
|
||||
AutoFocus = false;
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop;
|
||||
BackgroundColor = Color.Transparent;
|
||||
@@ -75,13 +72,13 @@ public class WindowDecorations : ContainerControl
|
||||
{
|
||||
_icon.Margin = new Margin(6, 6, 6, 6);
|
||||
Height = 28;
|
||||
|
||||
|
||||
_window.HitTest += OnHitTest;
|
||||
_window.Closed += OnWindowClosed;
|
||||
|
||||
|
||||
FontAsset windowIconsFont = FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.WindowIconsFont);
|
||||
Font iconFont = windowIconsFont?.CreateFont(9);
|
||||
|
||||
|
||||
_title = new Label(0, 0, Width, Height)
|
||||
{
|
||||
Text = _window.Title,
|
||||
@@ -150,7 +147,7 @@ public class WindowDecorations : ContainerControl
|
||||
_charChromeMaximize = ((char)EditorAssets.SegMDL2Icons.ChromeMaximize).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
@@ -216,20 +213,20 @@ public class WindowDecorations : ContainerControl
|
||||
if (pos.Y > winSize.Y - distance)
|
||||
return WindowHitCodes.Bottom;
|
||||
}
|
||||
|
||||
|
||||
var controlUnderMouse = GetChildAt(pos, control => control != _title);
|
||||
if (_title.Bounds.Contains(pos) && controlUnderMouse == null)
|
||||
return WindowHitCodes.Caption;
|
||||
|
||||
return WindowHitCodes.Client;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||
{
|
||||
// These may not work with main window due to SDL not passing mouse events
|
||||
// when interacting with hit tests on caption area...
|
||||
|
||||
|
||||
if (Title.Bounds.Contains(location) && button == MouseButton.Left)
|
||||
{
|
||||
if (_window.IsMaximized)
|
||||
@@ -251,7 +248,7 @@ public class WindowDecorations : ContainerControl
|
||||
{
|
||||
// Calculate extents for title bounds area excluding the icon and main menu area
|
||||
float x = 0;
|
||||
|
||||
|
||||
// Icon
|
||||
if (_icon != null)
|
||||
{
|
||||
@@ -273,7 +270,7 @@ public class WindowDecorations : ContainerControl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Buttons
|
||||
float rightMostButtonX = Width;
|
||||
if (_closeButton != null)
|
||||
@@ -302,7 +299,7 @@ public class WindowDecorations : ContainerControl
|
||||
_title.Bounds = new Rectangle(x, 0, rightMostButtonX - x, Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
@@ -321,7 +318,7 @@ public class WindowDecorations : ContainerControl
|
||||
|
||||
if (Editor.Instance.UI.StatusBar == null)
|
||||
return;
|
||||
|
||||
|
||||
const float thickness = 1.0f;
|
||||
Color color = Editor.Instance.UI.StatusBar.StatusColor;
|
||||
Rectangle rect = new Rectangle(thickness * 0.5f, thickness * 0.5f, Parent.Width - thickness, Parent.Height - thickness);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
private class MainWindowDecorations : WindowDecorations
|
||||
{
|
||||
public MainWindowDecorations(RootControl window, bool iconOnly)
|
||||
public MainWindowDecorations(RootControl window, bool iconOnly)
|
||||
: base(window, iconOnly)
|
||||
{
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace FlaxEditor.Modules
|
||||
var editor = Editor.Instance;
|
||||
return editor.Windows.EditWin.InputActions.Process(editor, this, key);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void DrawBorders()
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace FlaxEditor.Modules
|
||||
Render2D.DrawLine(rect.UpperRight, rect.BottomRight, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private struct Status
|
||||
{
|
||||
public int ID;
|
||||
@@ -78,7 +78,7 @@ namespace FlaxEditor.Modules
|
||||
private bool _progressFailed;
|
||||
|
||||
ContextMenuSingleSelectGroup<int> _numberOfClientsGroup = new ContextMenuSingleSelectGroup<int>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines a viewport scaling option.
|
||||
/// </summary>
|
||||
@@ -99,7 +99,7 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
Aspect = 1,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The name.
|
||||
/// </summary>
|
||||
@@ -115,7 +115,7 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
public Int2 Size;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The default viewport scaling options.
|
||||
/// </summary>
|
||||
@@ -486,7 +486,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
// Update window background
|
||||
mainWindow.BackgroundColor = Style.Current.Background;
|
||||
|
||||
|
||||
InitViewportScaleOptions();
|
||||
|
||||
InitSharedMenus();
|
||||
@@ -497,7 +497,7 @@ namespace FlaxEditor.Modules
|
||||
InitWindowDecorations(mainWindow);
|
||||
|
||||
Editor.Options.OptionsChanged += OnOptionsChanged;
|
||||
|
||||
|
||||
mainWindow.PerformLayout(true);
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ namespace FlaxEditor.Modules
|
||||
Size = new Int2(2560, 1440),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData("CustomViewportScalingOptions", out string data))
|
||||
{
|
||||
CustomViewportScaleOptions = JsonSerializer.Deserialize<List<ViewportScaleOption>>(data);
|
||||
@@ -549,7 +549,7 @@ namespace FlaxEditor.Modules
|
||||
public void SaveCustomViewportScalingOptions()
|
||||
{
|
||||
var customOptions = JsonSerializer.Serialize(CustomViewportScaleOptions);
|
||||
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
|
||||
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -778,7 +778,7 @@ namespace FlaxEditor.Modules
|
||||
MenuWindow = MainMenu.AddButton("Window");
|
||||
cm = MenuWindow.ContextMenu;
|
||||
cm.VisibleChanged += OnMenuWindowVisibleChanged;
|
||||
cm.AddButton("Content", inputOptions.ContentWindow,Editor.Windows.ContentWin.FocusOrShow);
|
||||
cm.AddButton("Content", inputOptions.ContentWindow, Editor.Windows.ContentWin.FocusOrShow);
|
||||
cm.AddButton("Scene", inputOptions.SceneWindow, Editor.Windows.SceneWin.FocusOrShow);
|
||||
cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow);
|
||||
cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow);
|
||||
@@ -817,14 +817,14 @@ namespace FlaxEditor.Modules
|
||||
var driver = Platform.DisplayServer;
|
||||
if (!string.IsNullOrEmpty(driver))
|
||||
driver = $" ({driver})";
|
||||
|
||||
|
||||
WindowDecorations = new MainWindowDecorations(mainWindow, !Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true))
|
||||
{
|
||||
Parent = mainWindow,
|
||||
IconTooltipText = $"{mainWindow.RootWindow.Title}\nVersion {Globals.EngineVersion}\nConfiguration {configuration}\nGraphics {GPUDevice.Instance.RendererType}{driver}",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void OnOptionsChanged(EditorOptions options)
|
||||
{
|
||||
var inputOptions = options.Input;
|
||||
|
||||
@@ -85,10 +85,12 @@ namespace FlaxEditor.Options
|
||||
/// Never show the close button.
|
||||
/// </summary>
|
||||
Never,
|
||||
|
||||
/// <summary>
|
||||
/// Show the close button on tabs that are currently selected.
|
||||
/// </summary>
|
||||
SelectedTab,
|
||||
|
||||
/// <summary>
|
||||
/// Show the close button on all tabs that can be closed.
|
||||
/// </summary>
|
||||
@@ -188,18 +190,18 @@ namespace FlaxEditor.Options
|
||||
/// Determined automatically based on the system and any known compatibility issues with native decorations.
|
||||
/// </summary>
|
||||
Auto,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Automatically choose most compatible window decorations for child windows, prefer custom decorations on main window.
|
||||
/// </summary>
|
||||
[EditorDisplay(Name = "Auto (Child Only)")]
|
||||
AutoChildOnly,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use native system window decorations on all windows.
|
||||
/// </summary>
|
||||
Native,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use custom client-side window decorations on all windows.
|
||||
/// </summary>
|
||||
@@ -322,7 +324,7 @@ namespace FlaxEditor.Options
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating wether the minum tab width should be used. Editor restart required.
|
||||
/// Gets or sets a value indicating whether the minimum tab width should be used. Editor restart required.
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[EditorDisplay("Tabs & Windows"), EditorOrder(99)]
|
||||
@@ -518,7 +520,7 @@ namespace FlaxEditor.Options
|
||||
[DefaultValue(1), Range(1, 4)]
|
||||
[EditorDisplay("Cook & Run"), EditorOrder(600)]
|
||||
public int NumberOfGameClientsToLaunch = 1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the build configuration to use when using Cook and Run option in the editor.
|
||||
/// </summary>
|
||||
@@ -533,7 +535,7 @@ namespace FlaxEditor.Options
|
||||
public float ConnectionCurvature { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that indicates wether the context menu description panel is shown or not.
|
||||
/// Gets or sets a value that indicates whether the context menu description panel is shown or not.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")]
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// [Deprecated in v1.12]
|
||||
#include "Engine/Platform/ScreenUtilities.h"
|
||||
|
||||
@@ -1586,6 +1586,7 @@ namespace FlaxEditor.Utilities
|
||||
|
||||
internal static bool UseCustomWindowDecorations(bool isMainWindow = false)
|
||||
{
|
||||
#if PLATFORM_SDL
|
||||
return Editor.Instance.Options.Options.Interface.WindowDecorations switch
|
||||
{
|
||||
Options.InterfaceOptions.WindowDecorationsType.Auto => !Platform.SupportsNativeDecorations,
|
||||
@@ -1594,6 +1595,11 @@ namespace FlaxEditor.Utilities
|
||||
Options.InterfaceOptions.WindowDecorationsType.ClientSide => true,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
#elif PLATFORM_WINDOWS
|
||||
return !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool HideSingleTabWindowTabBars()
|
||||
|
||||
@@ -1923,10 +1923,9 @@ namespace FlaxEditor.Viewport
|
||||
_input.MouseWheelDelta = 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnMouseMoveRelative(ref Float2 mouseMotion)
|
||||
private void OnMouseMoveRelative(ref Float2 motion)
|
||||
{
|
||||
_mouseDelta += mouseMotion;
|
||||
_mouseDelta += motion;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user