Tweaks
This commit is contained in:
@@ -29,7 +29,7 @@ namespace FlaxEditor.Content
|
||||
if (asset)
|
||||
{
|
||||
var source = Editor.GetShaderSourceCode(asset);
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source");
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source", item.RootWindow.Window);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1643,7 +1643,8 @@ namespace FlaxEditor.Utilities
|
||||
/// </summary>
|
||||
/// <param name="source">The source code.</param>
|
||||
/// <param name="title">The window title.</param>
|
||||
public static void ShowSourceCodeWindow(string source, string title)
|
||||
/// <param name="parentWindow">The optional parent window.</param>
|
||||
public static void ShowSourceCodeWindow(string source, string title, Window parentWindow = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
{
|
||||
@@ -1656,8 +1657,9 @@ namespace FlaxEditor.Utilities
|
||||
settings.AllowMaximize = false;
|
||||
settings.AllowMinimize = false;
|
||||
settings.HasSizingFrame = false;
|
||||
settings.StartPosition = WindowStartPosition.CenterScreen;
|
||||
settings.Size = new Vector2(500, 600) * Platform.DpiScale; // TODO: Place the window on the correct screen (and use that screen's size)
|
||||
settings.StartPosition = WindowStartPosition.CenterParent;
|
||||
settings.Size = new Vector2(500, 600) * (parentWindow?.DpiScale ?? Platform.DpiScale);
|
||||
settings.Parent = parentWindow;
|
||||
settings.Title = title;
|
||||
var dialog = Platform.CreateWindow(ref settings);
|
||||
|
||||
|
||||
@@ -241,10 +241,10 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// Shows the material source code window.
|
||||
/// </summary>
|
||||
/// <param name="material">The material asset.</param>
|
||||
public static void ShowSourceCode(Material material)
|
||||
public void ShowSourceCode(Material material)
|
||||
{
|
||||
var source = Editor.GetShaderSourceCode(material);
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Material Source");
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Material Source", RootWindow.Window);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -147,10 +147,10 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// Shows the ParticleEmitter source code window.
|
||||
/// </summary>
|
||||
/// <param name="particleEmitter">The ParticleEmitter asset.</param>
|
||||
public static void ShowSourceCode(ParticleEmitter particleEmitter)
|
||||
public void ShowSourceCode(ParticleEmitter particleEmitter)
|
||||
{
|
||||
var source = Editor.GetShaderSourceCode(particleEmitter);
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Particle Emitter GPU Simulation Source");
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Particle Emitter GPU Simulation Source", RootWindow.Window);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -551,7 +551,6 @@ public:
|
||||
return _dpi;
|
||||
}
|
||||
|
||||
// TODO: This doesn't actually include the custom DPI scale
|
||||
/// <summary>
|
||||
/// Gets the window DPI scale factor (1 is default). Includes custom DPI scale
|
||||
/// </summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ int32 CalculateDpi(HMODULE shCoreDll)
|
||||
|
||||
if (getDPIForMonitor)
|
||||
{
|
||||
HMONITOR monitor = GetPrimaryMonitorHandle(); // TODO: Use the game window monitor
|
||||
HMONITOR monitor = GetPrimaryMonitorHandle();
|
||||
|
||||
UINT x = 0, y = 0;
|
||||
HRESULT hr = getDPIForMonitor(monitor, 0, &x, &y);
|
||||
|
||||
@@ -99,7 +99,7 @@ WindowsWindow::WindowsWindow(const CreateWindowSettings& settings)
|
||||
nullptr);
|
||||
|
||||
_dpi = DefaultDPI;
|
||||
// TODO: Is this the correct way of doing this?
|
||||
|
||||
const HMODULE user32Dll = LoadLibraryW(L"user32.dll");
|
||||
if (user32Dll)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user