Last part of fix for Issue 170 - thx Salad.insalata :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2133 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-10-06 13:27:56 +00:00
parent 4b163e88d6
commit ad5d3f5c19
4 changed files with 62 additions and 46 deletions

View File

@ -32,28 +32,28 @@
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
//
//
// maskedTextBox1
//
//
this.maskedTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.maskedTextBox1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
this.maskedTextBox1.Location = new System.Drawing.Point(4, 4);
this.maskedTextBox1.Location = new System.Drawing.Point(4, 3);
this.maskedTextBox1.Mask = "00:00:00.000";
this.maskedTextBox1.Name = "maskedTextBox1";
this.maskedTextBox1.Size = new System.Drawing.Size(67, 13);
this.maskedTextBox1.Size = new System.Drawing.Size(71, 13);
this.maskedTextBox1.TabIndex = 21;
this.maskedTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MaskedTextBox1KeyDown);
//
//
// numericUpDown1
//
//
this.numericUpDown1.Location = new System.Drawing.Point(2, 1);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(87, 20);
this.numericUpDown1.Size = new System.Drawing.Size(91, 20);
this.numericUpDown1.TabIndex = 20;
this.numericUpDown1.TabStop = false;
//
//
// TimeUpDown
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
@ -61,7 +61,7 @@
this.Controls.Add(this.maskedTextBox1);
this.Controls.Add(this.numericUpDown1);
this.Name = "TimeUpDown";
this.Size = new System.Drawing.Size(92, 24);
this.Size = new System.Drawing.Size(94, 24);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -62,10 +62,7 @@ namespace Nikse.SubtitleEdit.Controls
}
else if (numericUpDown1.Value < NumericUpDownValue)
{
if (millisecs.Value - 100 > 0)
SetTotalMilliseconds(millisecs.Value - 100);
else if (millisecs.Value > 0)
SetTotalMilliseconds(0);
SetTotalMilliseconds(millisecs.Value - 100);
}
}
else
@ -101,9 +98,17 @@ namespace Nikse.SubtitleEdit.Controls
{
TimeSpan ts = TimeSpan.FromMilliseconds(milliseconds);
if (Mode == TimeMode.HHMMSSMS)
{
if (Mode == TimeMode.HHMMSSMS && milliseconds < 0)
maskedTextBox1.Mask = "-00:00:00.000";
else
maskedTextBox1.Mask = "00:00:00.000";
maskedTextBox1.Text = new TimeCode(ts).ToString();
}
else
maskedTextBox1.Text = new TimeCode(ts).ToString().Substring(0,9) + string.Format("{0:00}", Logic.SubtitleFormats.SubtitleFormat.MillisecondsToFrames(ts.Milliseconds));
{
maskedTextBox1.Text = new TimeCode(ts).ToString().Substring(0, 9) + string.Format("{0:00}", Logic.SubtitleFormats.SubtitleFormat.MillisecondsToFrames(ts.Milliseconds));
}
}
public double? GetTotalMilliseconds()
@ -146,7 +151,10 @@ namespace Nikse.SubtitleEdit.Controls
if (Utilities.IsInteger(times[3]))
milliSeconds = int.Parse(times[3].PadRight(3, '0'));
return new TimeCode(hours, minutes, seconds, milliSeconds);
var tc = new TimeCode(hours, minutes, seconds, milliSeconds);
if (times[0].StartsWith("-") && tc.TotalMilliseconds > 0)
tc.TotalMilliseconds = tc.TotalMilliseconds * -1;
return tc;
}
}
else
@ -181,7 +189,9 @@ namespace Nikse.SubtitleEdit.Controls
}
set
{
if (Mode == TimeMode.HHMMSSMS)
if (Mode == TimeMode.HHMMSSMS && value != null && value.TotalMilliseconds < 0)
maskedTextBox1.Mask = "-00:00:00.000";
else if (Mode == TimeMode.HHMMSSMS)
maskedTextBox1.Mask = "00:00:00.000";
else
maskedTextBox1.Mask = "00:00:00:00";

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -12852,8 +12852,14 @@ namespace Nikse.SubtitleEdit.Forms
timeUpDownVideoPositionAdjust.Enabled = true;
}
int index = ShowSubtitle();
timeUpDownVideoPosition.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(mediaPlayer.CurrentPosition * 1000.0));
timeUpDownVideoPositionAdjust.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(mediaPlayer.CurrentPosition * 1000.0));
double pos = mediaPlayer.CurrentPosition * 1000.0;
if (timeUpDownVideoPosition.TimeCode.TotalMilliseconds != pos)
timeUpDownVideoPosition.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(pos));
if (timeUpDownVideoPositionAdjust.TimeCode.TotalMilliseconds != pos)
timeUpDownVideoPositionAdjust.TimeCode = new TimeCode(TimeSpan.FromMilliseconds(pos));
mediaPlayer.RefreshProgressBar();
trackBarWaveFormPosition.ValueChanged -= trackBarWaveFormPosition_ValueChanged;