few layout problems were fixed, autosize for instance did not work

This commit is contained in:
Frank Skare
2019-07-13 16:35:42 +02:00
parent 5c053bb5eb
commit d27778775d
6 changed files with 51 additions and 27 deletions

View File

@@ -1,3 +1,7 @@
### 4.7.1
- few layout problems were fixed, autosize for instance did not work
### 4.7
- remember-height was replaced with start-size, when start-size is set
@@ -7,14 +11,14 @@
- on exit the window location can be saved with remember-position
- in the learn window of the input editor underscores were stripped
because they have a special meaning in WPF labels
- keys/input not working for MBTN_LEFT_DBL, MBTN_BACK, MBTN_FORWARD
- fix for keys/input not working for MBTN_LEFT_DBL, MBTN_BACK, MBTN_FORWARD
- in the learn window of the input editor support was added for
mouse left, mouse left double, mouse mid, mouse forward, mouse back
- libmpv updated to shinchiro 2019-07-07
- libmpv was updated to shinchiro 2019-07-07
- when border is none it wasn't possible to minimize the window from
the task bar because this is the WinForms default behavier. This
was fixed by calling Spy++ to the rescue and adding WS_MINIMIZEBOX
in CreateParams
in CreateParams
### 4.6

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.7.0.0")]
[assembly: AssemblyFileVersion("4.7.0.0")]
[assembly: AssemblyVersion("4.7.1.0")]
[assembly: AssemblyFileVersion("4.7.1.0")]

View File

@@ -274,7 +274,7 @@ options = [{ name = "yes", help = "Don't terminate if the current file is the
[[settings]]
name = "loop-file"
filter = "Playback"
help = "Loop a single file N times. inf means forever, no means normal playback.\n\nThe difference to loop-playlist is that this doesn't loop the playlist, just the file itself. If the playlist contains only a single file, the difference between the two option is that this option performs a seek on loop, instead of reloading the file. loop is an alias for this option."
help = "<N|inf|no> Loop a single file N times. inf means forever, no means normal playback.\n\nThe difference to loop-playlist is that this doesn't loop the playlist, just the file itself. If the playlist contains only a single file, the difference between the two option is that this option performs a seek on loop, instead of reloading the file. loop is an alias for this option."
[[settings]]
name = "save-position-on-quit"

View File

@@ -45,7 +45,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(288F, 288F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(1777, 1109);
this.ClientSize = new System.Drawing.Size(348, 0);
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);

View File

@@ -221,6 +221,8 @@ namespace mpvnet
return null;
}
bool WasInitialSizeSet;
void SetFormPosAndSize()
{
if (mp.Fullscreen)
@@ -229,23 +231,31 @@ namespace mpvnet
return;
}
Size size = mp.VideoSize;
Screen screen = Screen.FromControl(this);
int fixedHeight = Convert.ToInt32(screen.Bounds.Height * mp.Autofit);
int autoFitHeight = Convert.ToInt32(screen.Bounds.Height * mp.Autofit);
if (size.Height == 0 || size.Width == 0 || size.Width / (float)size.Height < 1.3)
{
size.Height = fixedHeight;
size.Width = (int)(fixedHeight * 1.7);
}
if (mp.VideoSize.Height == 0 || mp.VideoSize.Width == 0 ||
mp.VideoSize.Width / (float)mp.VideoSize.Height < 1.3)
mp.VideoSize = new Size((int)(autoFitHeight * 1.7), autoFitHeight);
Size size = mp.VideoSize;
int height = size.Height;
if (App.RememberHeight)
height = ClientSize.Height;
{
if (WasInitialSizeSet)
height = ClientSize.Height;
else
{
height = autoFitHeight;
WasInitialSizeSet = true;
}
}
if (height > screen.Bounds.Height * 0.9)
height = fixedHeight;
height = autoFitHeight;
int width = Convert.ToInt32(height * size.Width / (double)size.Height);
Point middlePos = new Point(Left + Width / 2, Top + Height / 2);

View File

@@ -79,6 +79,8 @@ namespace mpvnet
public static float Autofit { get; set; } = 0.5f;
static string LastPlaybackRestartFile;
public static void Init()
{
LoadLibrary("mpv-1.dll");
@@ -211,7 +213,7 @@ namespace mpvnet
if (WindowHandle == IntPtr.Zero)
WindowHandle = FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
//System.Diagnostics.Debug.WriteLine(evt.event_id.ToString());
// System.Diagnostics.Debug.WriteLine(evt.event_id.ToString());
try
{
@@ -309,17 +311,21 @@ namespace mpvnet
break;
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
PlaybackRestart?.Invoke();
Size vidSize = new Size(get_property_int("dwidth"), get_property_int("dheight"));
if (VideoSize != vidSize && vidSize != Size.Empty)
string path = get_property_string("path");
if (LastPlaybackRestartFile != path)
{
VideoSize = vidSize;
VideoSizeChanged?.Invoke();
Size vidSize = new Size(get_property_int("dwidth"), get_property_int("dheight"));
if (vidSize.Width == 0 || vidSize.Height == 0)
vidSize = new Size(1, 1);
if (VideoSize != vidSize)
{
VideoSize = vidSize;
VideoSizeChanged?.Invoke();
}
VideoSizeAutoResetEvent.Set();
Task.Run(new Action(() => ReadMetaData()));
LastPlaybackRestartFile = path;
}
VideoSizeAutoResetEvent.Set();
Task.Run(new Action(() => ReadMetaData()));
break;
case mpv_event_id.MPV_EVENT_CHAPTER_CHANGE:
ChapterChange?.Invoke();
@@ -516,7 +522,11 @@ namespace mpvnet
Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control));
if (files.Count == 0) VideoSizeAutoResetEvent.Set();
if (files.Count == 0)
{
VideoSizeAutoResetEvent.Set();
VideoSizeChanged?.Invoke();
}
foreach (string i in args)
{