config editor support for all screenshot settings

This commit is contained in:
Frank Skare
2019-07-24 19:04:04 +02:00
parent 9ea9cb2757
commit a49b9bea61
8 changed files with 84 additions and 118 deletions

View File

@@ -1,6 +1,11 @@
### ###
- icon was modified - changed icon design
- libmpv was updated to shinchiro 2019-07-14
- new or improved config editor settings: screenshot-directory,
screenshot-format, screenshot-tag-colorspace, screenshot-high-bit-depth,
screenshot-jpeg-source-chroma, screenshot-template, screenshot-jpeg-quality,
screenshot-png-compression, screenshot-png-filter
### 4.7.7 ### 4.7.7

View File

@@ -56,7 +56,7 @@ namespace DynamicGUI
baseSetting.Filter = setting["filter"]; baseSetting.Filter = setting["filter"];
if (setting.HasKey("help")) baseSetting.Help = setting["help"]; if (setting.HasKey("help")) baseSetting.Help = setting["help"];
if (setting.HasKey("helpurl")) baseSetting.HelpURL = setting["helpurl"]; if (setting.HasKey("url")) baseSetting.URL = setting["url"];
if (setting.HasKey("width")) baseSetting.Width = setting["width"]; if (setting.HasKey("width")) baseSetting.Width = setting["width"];
if (setting.HasKey("type")) baseSetting.Type = setting["type"]; if (setting.HasKey("type")) baseSetting.Type = setting["type"];
@@ -73,7 +73,7 @@ namespace DynamicGUI
public string StartValue { get; set; } public string StartValue { get; set; }
public string Help { get; set; } public string Help { get; set; }
public string Default { get; set; } public string Default { get; set; }
public string HelpURL { get; set; } public string URL { get; set; }
public string Filter { get; set; } public string Filter { get; set; }
public string Type { get; set; } public string Type { get; set; }
public int Width { get; set; } public int Width { get; set; }

View File

@@ -16,9 +16,9 @@ namespace DynamicGUI
HelpTextBox.Visibility = Visibility.Collapsed; HelpTextBox.Visibility = Visibility.Collapsed;
HelpTextBox.Text = optionSetting.Help; HelpTextBox.Text = optionSetting.Help;
ItemsControl.ItemsSource = optionSetting.Options; ItemsControl.ItemsSource = optionSetting.Options;
if (string.IsNullOrEmpty(optionSetting.HelpURL)) if (string.IsNullOrEmpty(optionSetting.URL))
LinkTextBlock.Visibility = Visibility.Collapsed; LinkTextBlock.Visibility = Visibility.Collapsed;
Link.SetURL(optionSetting.HelpURL); Link.SetURL(optionSetting.URL);
} }
private string _SearchableText; private string _SearchableText;

View File

@@ -23,8 +23,8 @@ namespace DynamicGUI
ValueTextBox.Width = StringSetting.Width; ValueTextBox.Width = StringSetting.Width;
if (StringSetting.Type != "folder" && StringSetting.Type != "color") if (StringSetting.Type != "folder" && StringSetting.Type != "color")
Button.Visibility = Visibility.Hidden; Button.Visibility = Visibility.Hidden;
Link.SetURL(StringSetting.HelpURL); Link.SetURL(StringSetting.URL);
if (string.IsNullOrEmpty(stringSetting.HelpURL)) if (string.IsNullOrEmpty(stringSetting.URL))
LinkTextBlock.Visibility = Visibility.Collapsed; LinkTextBlock.Visibility = Visibility.Collapsed;
} }

View File

@@ -25,9 +25,9 @@ namespace mpvnet
public static string DarkColor { get; set; } public static string DarkColor { get; set; }
public static string LightColor { get; set; } public static string LightColor { get; set; }
public static string[] VideoTypes { get; } = "mkv mp4 mpg avi mov webm vob wmv flv avs 264 h264 asf webm mpeg mpv y4m avc hevc 265 h265 m2v m2ts vpy mts m4v".Split(' '); public static string[] VideoTypes { get; } = "264 265 asf avc avi avs flv h264 h265 hevc m2ts m2v m4v mkv mov mp4 mpeg mpg mpv mts ts vob vpy webm webm wmv y4m".Split(' ');
public static string[] AudioTypes { get; } = "mp3 mp2 ac3 ogg opus flac wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 mka aac mpa".Split(' '); public static string[] AudioTypes { get; } = "mp3 mp2 ac3 ogg opus flac wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 mka aac mpa".Split(' ');
public static string[] ImageTypes { get; } = "jpg bmp gif".Split(' '); public static string[] ImageTypes { get; } = "jpg bmp gif png".Split(' ');
public static string[] SubtitleTypes { get; } = "srt ass idx sup ttxt ssa smi".Split(' '); public static string[] SubtitleTypes { get; } = "srt ass idx sup ttxt ssa smi".Split(' ');
public static string[] UrlWhitelist { get; set; } = { "tube", "vimeo", "ard", "zdf" }; public static string[] UrlWhitelist { get; set; } = { "tube", "vimeo", "ard", "zdf" };

View File

@@ -1,24 +1,6 @@
//------------------------------------------------------------------------------ namespace mpvnet.Properties {
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace mpvnet.Properties {
using System; using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -32,9 +14,6 @@ namespace mpvnet.Properties {
internal Resources() { internal Resources() {
} }
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
@@ -46,10 +25,6 @@ namespace mpvnet.Properties {
} }
} }
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
get { get {
@@ -60,70 +35,24 @@ namespace mpvnet.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to
/// # This file defines the input (keys and mouse) bindings of mpv and mpv.net
/// # and it also defines the context menu of mpv.net. mpv.net has an input
/// # editor and an config editor as alternative to editing conf text files.
/// # The input and config editor can be found in mpv.net&apos;s context menu at:
///
/// # Settings &gt; Show Config Editor
/// # Settings &gt; Show Input Editor
///
/// # The defaults of this file can be found at:
///
/// # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt
///
/// # th [rest of string was truncated]&quot;;.
/// </summary>
internal static string inputConf { internal static string inputConf {
get { get {
return ResourceManager.GetString("inputConf", resourceCulture); return ResourceManager.GetString("inputConf", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to
///# manual: https://mpv.io/manual/master/
///
///# defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt
///
///input-ar-delay = 500
///input-ar-rate = 20
///volume = 50
///hwdec = yes
///keep-open = yes
///keep-open-pause = no
///osd-playing-msg = &apos;${filename}&apos;
///screenshot-directory = &apos;~~desktop/&apos;
///input-default-bindings = no
///script-opts=osc-scalewindowed=1.5.
/// </summary>
internal static string mpvConf { internal static string mpvConf {
get { get {
return ResourceManager.GetString("mpvConf", resourceCulture); return ResourceManager.GetString("mpvConf", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to [[settings]]
///name = &quot;hwdec&quot;
///default = &quot;no&quot;
///filter = &quot;Video&quot;
///helpurl = &quot;https://mpv.io/manual/master/#options-hwdec&quot;
///help = &quot;Specify the hardware video decoding API that should be used if possible. Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall back on software decoding.\n\nFor more information visit:&quot;
///options = [{ name = &quot;no&quot;, help = &quot;always use software decoding&quot; },
/// { name = &quot;auto&quot;, help = &quot;enabl [rest of string was truncated]&quot;;.
/// </summary>
internal static string mpvConfToml { internal static string mpvConfToml {
get { get {
return ResourceManager.GetString("mpvConfToml", resourceCulture); return ResourceManager.GetString("mpvConfToml", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap mpvnet { internal static System.Drawing.Bitmap mpvnet {
get { get {
object obj = ResourceManager.GetObject("mpvnet", resourceCulture); object obj = ResourceManager.GetObject("mpvnet", resourceCulture);
@@ -131,27 +60,6 @@ namespace mpvnet.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to [[settings]]
///name = &quot;dark-mode&quot;
///default = &quot;always&quot;
///filter = &quot;General&quot;
///help = &quot;Enables a dark theme. (mpv.net specific setting)&quot;
///options = [{ name = &quot;always&quot; },
/// { name = &quot;system&quot; , help = &quot;Available on Windows 10 or higher&quot; },
/// { name = &quot;never&quot; }]
///
///[[settings]]
///name = &quot;dark-color&quot;
///type = &quot;color&quot;
///filter = &quot;General&quot;
///help = &quot;Theme color used in dark-mode. Leave empty to use OS theme. (mpv.net specific setting)&quot;
///
///[[settings]]
///name = &quot;light-color&quot;
///type = &quot;color&quot;
///filter = &quot;General&quot; [rest of string was truncated]&quot;;.
/// </summary>
internal static string mpvNetConfToml { internal static string mpvNetConfToml {
get { get {
return ResourceManager.GetString("mpvNetConfToml", resourceCulture); return ResourceManager.GetString("mpvNetConfToml", resourceCulture);

View File

@@ -2,7 +2,7 @@
name = "hwdec" name = "hwdec"
default = "no" default = "no"
filter = "Video" filter = "Video"
helpurl = "https://mpv.io/manual/master/#options-hwdec" url = "https://mpv.io/manual/master/#options-hwdec"
help = "Specify the hardware video decoding API that should be used if possible. Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall back on software decoding.\n\nFor more information visit:" help = "Specify the hardware video decoding API that should be used if possible. Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall back on software decoding.\n\nFor more information visit:"
options = [{ name = "no", help = "always use software decoding" }, options = [{ name = "no", help = "always use software decoding" },
{ name = "auto", help = "enable best hw decoder (see below)" }, { name = "auto", help = "enable best hw decoder (see below)" },
@@ -45,7 +45,7 @@ name = "vo"
default = "gpu" default = "gpu"
filter = "Video" filter = "Video"
help = "Video output drivers to be used.\n\nFor more information visit:" help = "Video output drivers to be used.\n\nFor more information visit:"
helpurl = "https://mpv.io/manual/master/#video-output-drivers-vo" url = "https://mpv.io/manual/master/#video-output-drivers-vo"
options = [{ name = "gpu", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more." }, options = [{ name = "gpu", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more." },
{ name = "direct3d", help = "Video output driver that uses the Direct3D interface" }] { name = "direct3d", help = "Video output driver that uses the Direct3D interface" }]
@@ -54,7 +54,7 @@ name = "video-sync"
default = "audio" default = "audio"
filter = "Video" filter = "Video"
help = "How the player synchronizes audio and video.\n\nFor more information visit:" help = "How the player synchronizes audio and video.\n\nFor more information visit:"
helpurl = "https://mpv.io/manual/master/#options-video-sync" url = "https://mpv.io/manual/master/#options-video-sync"
options = [{ name = "audio" }, options = [{ name = "audio" },
{ name = "display-resample" }, { name = "display-resample" },
{ name = "display-resample-vdrop" }, { name = "display-resample-vdrop" },
@@ -233,7 +233,7 @@ width = 300
filter = "Screen" filter = "Screen"
type = "string" type = "string"
help = "Show a message on OSD when playback starts. The string is expanded for properties, e.g. osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename. For more information visit:" help = "Show a message on OSD when playback starts. The string is expanded for properties, e.g. osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename. For more information visit:"
helpurl = "https://mpv.io/manual/master/#property-expansion" url = "https://mpv.io/manual/master/#property-expansion"
[[settings]] [[settings]]
name = "osd-font-size" name = "osd-font-size"
@@ -241,13 +241,6 @@ default = "55"
filter = "Screen" filter = "Screen"
help = "Specify the OSD font size. See sub-font-size for details. Default: 55" help = "Specify the OSD font size. See sub-font-size for details. Default: 55"
[[settings]]
name = "screenshot-directory"
width = 500
type = "folder"
filter = "Screen"
help = "Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.\n\nIf the directory does not exist, it is created on the first screenshot. If it is not a directory, an error is generated when trying to write a screenshot.\n\nThis option is not set by default, and thus will write screenshots to the directory from which mpv was started. In pseudo-gui mode (see PSEUDO GUI MODE), this is set to the desktop."
[[settings]] [[settings]]
name = "autofit" name = "autofit"
filter = "Screen" filter = "Screen"
@@ -263,6 +256,67 @@ name = "autofit-larger"
filter = "Screen" filter = "Screen"
help = "<int> Maximum window height in percent. Default: 75%" help = "<int> Maximum window height in percent. Default: 75%"
[[settings]]
name = "screenshot-directory"
width = 500
type = "folder"
filter = "Screen"
help = "Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.\n\nIf the directory does not exist, it is created on the first screenshot. If it is not a directory, an error is generated when trying to write a screenshot."
[[settings]]
name = "screenshot-format"
default = "jpg"
filter = "Screen"
help = "Set the image file type used for saving screenshots."
options = [{ name = "jpg" },
{ name = "png" }]
[[settings]]
name = "screenshot-tag-colorspace"
default = "no"
filter = "Screen"
help = "Tag screenshots with the appropriate colorspace. Note that not all formats are supported."
options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "screenshot-high-bit-depth"
default = "yes"
filter = "Screen"
help = "If possible, write screenshots with a bit depth similar to the source video (default: yes). This is interesting in particular for PNG, as this sometimes triggers writing 16 bit PNGs with huge file sizes. This will also include an unused alpha channel in the resulting files if 16 bit is used."
options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "screenshot-jpeg-source-chroma"
default = "yes"
filter = "Screen"
help = "Write JPEG files with the same chroma subsampling as the video (default: yes). If disabled, the libjpeg default is used."
options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "screenshot-template"
filter = "Screen"
type = "string"
help = "Specify the filename template used to save screenshots. The template specifies the filename without file extension, and can contain format specifiers, which will be substituted when taking a screenshot. By default, the template is mpv-shot%n, which results in filenames like mpv-shot0012.png for example.\n\nFind the full documentation here:"
url = "https://mpv.io/manual/master/#options-screenshot-template"
[[settings]]
name = "screenshot-jpeg-quality"
filter = "Screen"
help = "<0-100> Set the JPEG quality level. Higher means better quality. The default is 90."
[[settings]]
name = "screenshot-png-compression"
filter = "Screen"
help = "<0-9> Set the PNG compression level. Higher means better compression. This will affect the file size of the written screenshot file and the time it takes to write a screenshot. Too high compression might occupy enough CPU time to interrupt playback. The default is 7."
[[settings]]
name = "screenshot-png-filter"
filter = "Screen"
help = "<0-5> Set the filter applied prior to PNG compression. 0 is none, 1 is 'sub', 2 is 'up', 3 is 'average', 4 is 'Paeth', and 5 is 'mixed'. This affects the level of compression that can be achieved. For most images, 'mixed' achieves the best compression ratio, hence it is the default."
[[settings]] [[settings]]
name = "keep-open-pause" name = "keep-open-pause"
default = "yes" default = "yes"

View File

@@ -9,7 +9,6 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization; using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks;
namespace mpvnet namespace mpvnet
{ {
@@ -22,7 +21,7 @@ namespace mpvnet
Point LastCursorPosChanged; Point LastCursorPosChanged;
int LastCursorChangedTickCount; int LastCursorChangedTickCount;
bool IgnoreDpiChanged = true; bool WasShown;
List<string> RecentFiles; List<string> RecentFiles;
public MainForm() public MainForm()
@@ -422,7 +421,7 @@ namespace mpvnet
} }
break; break;
case 0x02E0: // WM_DPICHANGED case 0x02E0: // WM_DPICHANGED
if (IgnoreDpiChanged) break; if (!WasShown) break;
var r2 = Marshal.PtrToStructure<Native.RECT>(m.LParam); var r2 = Marshal.PtrToStructure<Native.RECT>(m.LParam);
Native.SetWindowPos(Handle, IntPtr.Zero, r2.Left, r2.Top, r2.Width, r2.Height, 0); Native.SetWindowPos(Handle, IntPtr.Zero, r2.Left, r2.Top, r2.Width, r2.Height, 0);
break; break;
@@ -531,9 +530,9 @@ namespace mpvnet
ContextMenuStrip = ContextMenu; ContextMenuStrip = ContextMenu;
WPF.WPF.Init(); WPF.WPF.Init();
System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
IgnoreDpiChanged = false;
CheckClipboardForURL(); CheckClipboardForURL();
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
WasShown = true;
} }
protected override void OnActivated(EventArgs e) protected override void OnActivated(EventArgs e)