IMovie - refactor string GetTime() into TimeSpan Time, refactor accordingly, Fixing column size issues in Play movie dialog that was preventing the user from seeing the entire time without manually resizing.
This commit is contained in:
parent
62db53d28c
commit
1c22123da4
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -24,6 +25,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
double FrameCount { get; }
|
||||
|
||||
TimeSpan Time { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Actual length of the input log, should only be used by code that iterates or needs a real length
|
||||
/// </summary>
|
||||
|
@ -91,7 +94,7 @@ namespace BizHawk.Client.Common
|
|||
void CommitFrame(int frameNum, IController source); // Why pass in frameNum? Calling api
|
||||
void PokeFrame(int frameNum, string input); // Why does this exist as something different than Commit Frame?
|
||||
LoadStateResult CheckTimeLines(TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage); // No need to return a status, no reason to have hacky flags, no need to pass a textreader
|
||||
string GetTime(bool preLoad); // Rename to simply: Time, and make it a Timespan
|
||||
|
||||
void ExtractInputLog(TextReader reader, bool isMultitracking); // how about the movie know if it is multi-tracking rather than having to pass it in
|
||||
|
||||
string GetInput(int frame); // Should be a property of a Record object
|
||||
|
|
|
@ -546,30 +546,18 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public string GetTime(bool preLoad)
|
||||
public TimeSpan Time
|
||||
{
|
||||
var time = String.Empty;
|
||||
|
||||
double seconds = GetSeconds(preLoad ? _preloadFramecount : _log.Length);
|
||||
|
||||
int hours = ((int)seconds) / 3600;
|
||||
int minutes = (((int)seconds) / 60) % 60;
|
||||
double sec = seconds % 60;
|
||||
if (hours > 0)
|
||||
get
|
||||
{
|
||||
time += MakeDigits(hours) + ":";
|
||||
double dblseconds = GetSeconds(Loaded ? _log.Length : _preloadFramecount);
|
||||
int seconds = (int)(dblseconds % 60);
|
||||
int days = seconds / 86400;
|
||||
int hours = seconds / 3600;
|
||||
int minutes = (seconds / 60) % 60;
|
||||
int milliseconds = (int)((dblseconds - (double)seconds) * 1000);
|
||||
return new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
||||
}
|
||||
|
||||
time += MakeDigits(minutes) + ":";
|
||||
|
||||
if (sec < 10) // Kludge
|
||||
{
|
||||
time += "0";
|
||||
}
|
||||
|
||||
time += Math.Round((decimal)sec, 2).ToString();
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
public LoadStateResult CheckTimeLines(TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage)
|
||||
|
|
|
@ -65,6 +65,11 @@ namespace BizHawk.Client.Common
|
|||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public TimeSpan Time
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public double FrameCount
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
|
@ -150,11 +155,6 @@ namespace BizHawk.Client.Common
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetTime(bool preLoad)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ExtractInputLog(System.IO.TextReader reader, bool isMultitracking)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(678, 352);
|
||||
this.Cancel.Location = new System.Drawing.Point(687, 352);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 55;
|
||||
|
@ -69,7 +69,7 @@
|
|||
// OK
|
||||
//
|
||||
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OK.Location = new System.Drawing.Point(597, 352);
|
||||
this.OK.Location = new System.Drawing.Point(606, 352);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.TabIndex = 50;
|
||||
|
@ -126,7 +126,7 @@
|
|||
this.groupBox1.Controls.Add(this.SubtitlesBtn);
|
||||
this.groupBox1.Controls.Add(this.CommentsBtn);
|
||||
this.groupBox1.Controls.Add(this.DetailsView);
|
||||
this.groupBox1.Location = new System.Drawing.Point(494, 28);
|
||||
this.groupBox1.Location = new System.Drawing.Point(503, 28);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(259, 303);
|
||||
this.groupBox1.TabIndex = 6;
|
||||
|
@ -172,7 +172,7 @@
|
|||
this.ReadOnlyCheckBox.AutoSize = true;
|
||||
this.ReadOnlyCheckBox.Checked = true;
|
||||
this.ReadOnlyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.ReadOnlyCheckBox.Location = new System.Drawing.Point(494, 356);
|
||||
this.ReadOnlyCheckBox.Location = new System.Drawing.Point(503, 356);
|
||||
this.ReadOnlyCheckBox.Name = "ReadOnlyCheckBox";
|
||||
this.ReadOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
|
||||
this.ReadOnlyCheckBox.TabIndex = 45;
|
||||
|
@ -246,7 +246,7 @@
|
|||
this.MovieView.MultiSelect = false;
|
||||
this.MovieView.Name = "MovieView";
|
||||
this.MovieView.selectedItem = -1;
|
||||
this.MovieView.Size = new System.Drawing.Size(463, 303);
|
||||
this.MovieView.Size = new System.Drawing.Size(480, 303);
|
||||
this.MovieView.TabIndex = 5;
|
||||
this.MovieView.UseCompatibleStateImageBehavior = false;
|
||||
this.MovieView.View = System.Windows.Forms.View.Details;
|
||||
|
@ -275,7 +275,7 @@
|
|||
// columnHeader4
|
||||
//
|
||||
this.columnHeader4.Text = "Length (est.)";
|
||||
this.columnHeader4.Width = 64;
|
||||
this.columnHeader4.Width = 82;
|
||||
//
|
||||
// PlayMovie
|
||||
//
|
||||
|
@ -283,7 +283,7 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(765, 387);
|
||||
this.ClientSize = new System.Drawing.Size(774, 387);
|
||||
this.Controls.Add(this.MatchGameNameCheckBox);
|
||||
this.Controls.Add(this.Scan);
|
||||
this.Controls.Add(this.ShowStateFiles);
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
if (column == 3) //Time
|
||||
{
|
||||
text = _movieList[index].GetTime(true);
|
||||
text = _movieList[index].Time.ToString(@"hh\:mm\:ss\.fff");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
.Append(_movieList[index].Filename).Append('\t')
|
||||
.Append(_movieList[index].Header.SystemID).Append('\t')
|
||||
.Append(_movieList[index].Header.GameName).Append('\t')
|
||||
.Append(_movieList[index].GetTime(true)).AppendLine();
|
||||
.Append(_movieList[index].Time.ToString(@"hh\:mm\:ss\.fff"))
|
||||
.AppendLine();
|
||||
|
||||
Clipboard.SetDataObject(copyStr.ToString());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue