options autofit-smaller, autofit-larger added
This commit is contained in:
21
Changelog.md
21
Changelog.md
@@ -4,12 +4,21 @@
|
||||
WPF was returning a bad color on Win 7, this was fixed by reading
|
||||
the theme color from the Registry on Win 7. If the theme color
|
||||
is identical to the background color it's corrected
|
||||
- new option dark-color was added to overwrite the OS theme color used in dark mode, find the option under 'General'
|
||||
- new option light-color was added to overwrite the OS theme color used in non dark mode, find the option under 'General'
|
||||
- various changes regarding input handling
|
||||
- it's now possible to use a custom folder as config folder
|
||||
- slightly increased startup performance
|
||||
- start-threshold setting added. Threshold in milliseconds to wait for libmpv returning the video resolution before the window is shown, otherwise default dimensions are used as defined by autofit and start-size. Default: 1500
|
||||
- dark-color setting was added to overwrite the OS theme color used in dark mode,
|
||||
find the setting on the General tab
|
||||
- light-color setting was added to overwrite the OS theme color used in non dark mode,
|
||||
find the setting on the General tab
|
||||
- various changes regarding input handling, multi media keys and
|
||||
mouse forward/backward were tested on my system
|
||||
- it's now possible to use a custom folder as config folder,
|
||||
TaskDialog shows five options: 1. appdata mpv.net, 2. appdata mpv (shared with mpv),
|
||||
3. portable_config, 4. startup, 5. custom
|
||||
- slightly increased startup performance, start-threshold setting added.
|
||||
Threshold in milliseconds to wait for libmpv returning the video resolution
|
||||
before the window is shown, otherwise default dimensions are used as defined
|
||||
by autofit and start-size. Default: 1500
|
||||
- autofit-smaller setting added. Minimum window height in percent. Default: 40%
|
||||
- autofit-larger setting added. Maximum window height in percent. Default: 75%
|
||||
|
||||
### 4.7.3
|
||||
|
||||
|
||||
18
README.md
18
README.md
@@ -138,24 +138,30 @@ input.conf defines mpv's key and mouse bindings and mpv.net uses comments to def
|
||||
|
||||
mpv.net is able to share the settings with mpv.
|
||||
|
||||
If a directory named portable_config next to the mpvnet.exe exists, all config will be loaded from this directory only.
|
||||
If a directory named portable_config next to the mpvnet.exe exists,
|
||||
all config will be loaded from this directory only.
|
||||
|
||||
```Text
|
||||
<startup>\portable_config\
|
||||
```
|
||||
|
||||
On first start if no portable config folder exists mpv.net asks which folder should be used as config folder.
|
||||
On first start if no portable config folder exists mpv.net asks
|
||||
which folder should be used as config folder.
|
||||
|
||||
If no mpv.conf file exists mpv.net generates it with the following defaults:
|
||||
mpv specific settings are stored in the file mpv.conf, if no mpv.conf file exists
|
||||
mpv.net generates it with the following defaults:
|
||||
|
||||
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt>
|
||||
|
||||
The key bindings and the context menu definitions are stored in the input.conf file,
|
||||
if it's missing mpv.net generates it with the following defaults:
|
||||
mpv.net specific settings are stored in the file mpvnet.conf
|
||||
|
||||
The input (key/mouse) bindings and the context menu definitions are stored in the
|
||||
input.conf file, if it's missing mpv.net generates it with the following defaults:
|
||||
|
||||
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt>
|
||||
|
||||
mpv.net supports almost all mpv settings and features, [limitations are listed in the wiki](https://github.com/stax76/mpv.net/wiki/Limitations).
|
||||
mpv.net supports almost all mpv settings and features,
|
||||
[limitations are listed in the wiki](https://github.com/stax76/mpv.net/wiki/Limitations).
|
||||
|
||||
### Scripting
|
||||
|
||||
|
||||
@@ -250,9 +250,18 @@ help = "Store screenshots in this directory. This path is joined with the filena
|
||||
|
||||
[[settings]]
|
||||
name = "autofit"
|
||||
default = "50%"
|
||||
filter = "Screen"
|
||||
help = "Set the initial window size in percent. Please note that this setting is only partly implemented in mpv.net, accepted are only integer values with percent sign added. Default: 50%"
|
||||
help = "<int> Initial window height in percent. Default: 50%"
|
||||
|
||||
[[settings]]
|
||||
name = "autofit-smaller"
|
||||
filter = "Screen"
|
||||
help = "<int> Minimum window height in percent. Default: 40%"
|
||||
|
||||
[[settings]]
|
||||
name = "autofit-larger"
|
||||
filter = "Screen"
|
||||
help = "<int> Maximum window height in percent. Default: 75%"
|
||||
|
||||
[[settings]]
|
||||
name = "keep-open-pause"
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace mpvnet
|
||||
}
|
||||
|
||||
Screen screen = Screen.FromControl(this);
|
||||
int autoFitHeight = Convert.ToInt32(screen.Bounds.Height * mp.Autofit);
|
||||
int autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * mp.Autofit);
|
||||
|
||||
if (mp.VideoSize.Height == 0 || mp.VideoSize.Width == 0 ||
|
||||
mp.VideoSize.Width / (float)mp.VideoSize.Height < 1.3)
|
||||
@@ -258,10 +258,32 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
if (height > screen.Bounds.Height * 0.9)
|
||||
height = autoFitHeight;
|
||||
|
||||
int width = Convert.ToInt32(height * size.Width / (double)size.Height);
|
||||
|
||||
if (height > screen.WorkingArea.Height * 0.9)
|
||||
{
|
||||
height = Convert.ToInt32(screen.WorkingArea.Height * 0.9);
|
||||
width = Convert.ToInt32(height * size.Width / (double)size.Height);
|
||||
}
|
||||
|
||||
if (width > screen.WorkingArea.Width * 0.9)
|
||||
{
|
||||
width = Convert.ToInt32(screen.WorkingArea.Width * 0.9);
|
||||
height = Convert.ToInt32(width * size.Height / (double)size.Width);
|
||||
}
|
||||
|
||||
if (height < screen.WorkingArea.Height * mp.AutofitSmaller)
|
||||
{
|
||||
height = Convert.ToInt32(screen.WorkingArea.Height * mp.AutofitSmaller);
|
||||
width = Convert.ToInt32(height * size.Width / (double)size.Height);
|
||||
}
|
||||
|
||||
if (height > screen.WorkingArea.Height * mp.AutofitLarger)
|
||||
{
|
||||
height = Convert.ToInt32(screen.WorkingArea.Height * mp.AutofitLarger);
|
||||
width = Convert.ToInt32(height * size.Width / (double)size.Height);
|
||||
}
|
||||
|
||||
Point middlePos = new Point(Left + Width / 2, Top + Height / 2);
|
||||
var rect = new Native.RECT(new Rectangle(screen.Bounds.X, screen.Bounds.Y, width, height));
|
||||
NativeHelp.AddWindowBorders(Handle, ref rect);
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace mpvnet
|
||||
public static int Edition { get; set; }
|
||||
|
||||
public static float Autofit { get; set; } = 0.5f;
|
||||
public static float AutofitSmaller { get; set; } = 0.4f;
|
||||
public static float AutofitLarger { get; set; } = 0.75f;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
@@ -105,9 +107,16 @@ namespace mpvnet
|
||||
switch (name)
|
||||
{
|
||||
case "autofit":
|
||||
if (value.Length == 3 && value.EndsWith("%"))
|
||||
if (int.TryParse(value.Substring(0, 2), out int result))
|
||||
Autofit = result / 100f;
|
||||
if (int.TryParse(value.Trim('%'), out int result))
|
||||
Autofit = result / 100f;
|
||||
break;
|
||||
case "autofit-smaller":
|
||||
if (int.TryParse(value.Trim('%'), out int result2))
|
||||
AutofitSmaller = result2 / 100f;
|
||||
break;
|
||||
case "autofit-larger":
|
||||
if (int.TryParse(value.Trim('%'), out int result3))
|
||||
AutofitLarger = result3 / 100f;
|
||||
break;
|
||||
case "fs":
|
||||
case "fullscreen": Fullscreen = value == "yes"; break;
|
||||
|
||||
Reference in New Issue
Block a user