new window features
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
5.4.8.9 Beta (2021-??-??)
|
||||
=========================
|
||||
|
||||
- New `start-size` option to always keep and remember the width and height.
|
||||
- There is an issue with the `window-scale` mpv property, it does not
|
||||
work correctly in mpv either. I've removed support for it and
|
||||
work correctly in mpv either, so I've removed support for it and
|
||||
added an own implementation `script-message mpv.net window-scale`.
|
||||
- The previous Beta replaced the CS-Script library with an own
|
||||
- The previous Beta replaced the CS-Script library with my own
|
||||
C# scripting implementation.
|
||||
- If a player window border is near to a screen border and the window size
|
||||
changes, the player windows sticks to that near screen border location.
|
||||
- `start-size` option has new options, see in config editor and manual.
|
||||
|
||||
|
||||
5.4.8.8 Beta (2021-05-09)
|
||||
|
||||
@@ -217,6 +217,12 @@ Setting to remember the window size.
|
||||
**video**
|
||||
Window size is set to video resolution.
|
||||
|
||||
**width-session**
|
||||
Width is remembered in the current session.
|
||||
|
||||
**width-always**
|
||||
Width is always remembered.
|
||||
|
||||
**height-session**
|
||||
Height is remembered in the current session. Default
|
||||
|
||||
|
||||
@@ -343,6 +343,8 @@ default = "height-session"
|
||||
filter = "Screen"
|
||||
help = "Setting to remember the window size. (mpv.net specific setting)"
|
||||
options = [{ name = "video", help = "Window size is set to video resolution" },
|
||||
{ name = "width-session", help = "Width is remembered in the current session" },
|
||||
{ name = "width-always", help = "Width is always remembered" },
|
||||
{ name = "height-session", help = "Height is remembered in the current session" },
|
||||
{ name = "height-always", help = "Height is always remembered" },
|
||||
{ name = "always", help = "Size is always remembered" }]
|
||||
|
||||
@@ -366,6 +366,11 @@ namespace mpvnet
|
||||
height = ClientSize.Height;
|
||||
width = height * videoSize.Width / videoSize.Height;
|
||||
}
|
||||
else if (App.StartSize == "width-always" || App.StartSize == "width-session")
|
||||
{
|
||||
width = ClientSize.Width;
|
||||
height = (int)Math.Ceiling(width * videoSize.Height / (double)videoSize.Width);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -377,16 +382,26 @@ namespace mpvnet
|
||||
height = savedHeight;
|
||||
width = height * videoSize.Width / videoSize.Height;
|
||||
}
|
||||
else if (App.StartSize == "always" && savedHeight != 0)
|
||||
{
|
||||
height = savedHeight;
|
||||
width = savedWidth;
|
||||
}
|
||||
else if (App.StartSize == "height-session")
|
||||
{
|
||||
height = autoFitHeight;
|
||||
width = height * videoSize.Width / videoSize.Height;
|
||||
}
|
||||
if (App.StartSize == "width-always" && savedHeight != 0)
|
||||
{
|
||||
width = savedWidth;
|
||||
height = (int)Math.Ceiling(width * videoSize.Height / (double)videoSize.Width);
|
||||
}
|
||||
else if (App.StartSize == "width-session")
|
||||
{
|
||||
width = autoFitHeight / 9 * 16;
|
||||
height = (int)Math.Ceiling(width * videoSize.Height / (double)videoSize.Width);
|
||||
}
|
||||
else if (App.StartSize == "always" && savedHeight != 0)
|
||||
{
|
||||
height = savedHeight;
|
||||
width = savedWidth;
|
||||
}
|
||||
|
||||
core.WasInitialSizeSet = true;
|
||||
}
|
||||
@@ -420,7 +435,7 @@ namespace mpvnet
|
||||
if (width > maxWidth)
|
||||
{
|
||||
width = maxWidth;
|
||||
height = (int)Math.Ceiling(width * startHeight / (double)width);
|
||||
height = (int)Math.Ceiling(width * startHeight / (double)startWidth);
|
||||
}
|
||||
|
||||
if (height > maxHeight)
|
||||
@@ -440,6 +455,14 @@ namespace mpvnet
|
||||
NativeHelp.AddWindowBorders(Handle, ref rect);
|
||||
int left = middlePos.X - rect.Width / 2;
|
||||
int top = middlePos.Y - rect.Height / 2;
|
||||
Rectangle workingArea = screen.WorkingArea;
|
||||
Rectangle currentRect = new Rectangle(Left, Top, Width, Height);
|
||||
|
||||
if (HorizontalLocation(screen) == -1) left = Left;
|
||||
if (HorizontalLocation(screen) == 1) left = currentRect.Right - rect.Width;
|
||||
|
||||
if (VerticalLocation(screen) == -1) top = Top;
|
||||
if (VerticalLocation(screen) == 1) top = currentRect.Bottom - rect.Height;
|
||||
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
int minLeft = screens.Select(val => val.WorkingArea.X).Min();
|
||||
@@ -462,6 +485,34 @@ namespace mpvnet
|
||||
SetWindowPos(Handle, IntPtr.Zero, left, top, rect.Width, rect.Height, 4);
|
||||
}
|
||||
|
||||
public int HorizontalLocation(Screen screen)
|
||||
{
|
||||
Rectangle workingArea = screen.WorkingArea;
|
||||
Rectangle rect = new Rectangle(Left - workingArea.X, Top - workingArea.Y, Width, Height);
|
||||
|
||||
if (rect.X * 3 < workingArea.Width - rect.Right)
|
||||
return -1;
|
||||
|
||||
if (rect.X > (workingArea.Width - rect.Right) * 3)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int VerticalLocation(Screen screen)
|
||||
{
|
||||
Rectangle workingArea = screen.WorkingArea;
|
||||
Rectangle rect = new Rectangle(Left - workingArea.X, Top - workingArea.Y, Width, Height);
|
||||
|
||||
if (rect.Y * 3 < workingArea.Height - rect.Bottom)
|
||||
return -1;
|
||||
|
||||
if (rect.Y > (workingArea.Height - rect.Bottom) * 3)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void CycleFullscreen(bool enabled)
|
||||
{
|
||||
LastCycleFullscreen = Environment.TickCount;
|
||||
|
||||
Reference in New Issue
Block a user