mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-16 09:38:05 +00:00
More fixes to timleline
This commit is contained in:
parent
525d6d0b27
commit
70f1f971d9
9 changed files with 159 additions and 35 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -108,6 +108,7 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
animationTrackBar.BackColor = FormThemes.BaseTheme.FormBackColor;
|
||||
animationTrackBar.ForeColor = FormThemes.BaseTheme.FormForeColor;
|
||||
animationTrackBar.FrameChanged += new EventHandler(animationTrackBar_ValueChanged);
|
||||
|
||||
/* animationTrackBar.ThumbInnerColor = FormThemes.BaseTheme.TimelineThumbColor;
|
||||
animationTrackBar.ThumbOuterColor = FormThemes.BaseTheme.TimelineThumbColor;
|
||||
|
@ -196,6 +197,9 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
private void animationPlayBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentAnimation == null || currentAnimation.FrameCount <= 0)
|
||||
return;
|
||||
|
||||
if (AnimationPlayerState == PlayerState.Playing)
|
||||
Pause();
|
||||
else
|
||||
|
@ -353,7 +357,6 @@ namespace Switch_Toolbox.Library
|
|||
currentFrameUpDown.Value = totalFrame.Value;
|
||||
|
||||
animationTrackBar.CurrentFrame = (int)currentFrameUpDown.Value;
|
||||
|
||||
animationTrackBar.Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,16 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TimeLine
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "TimeLine";
|
||||
this.Resize += new System.EventHandler(this.TimeLine_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace Switch_Toolbox.Library.Forms
|
|||
|
||||
currentFrame = value;
|
||||
|
||||
FrameChanged?.Invoke(this, new EventArgs());
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
@ -65,22 +67,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||
}
|
||||
else
|
||||
{
|
||||
#region resolve collsions
|
||||
if (frameLeft < 0)
|
||||
{
|
||||
frameRight -= frameLeft;
|
||||
if (frameRight > frameCount)
|
||||
frameRight = frameCount;
|
||||
frameLeft = 0;
|
||||
}
|
||||
else if (frameRight > frameCount)
|
||||
{
|
||||
frameLeft += frameCount - frameRight;
|
||||
if (frameLeft < 0)
|
||||
frameLeft = 0;
|
||||
frameRight = frameCount;
|
||||
}
|
||||
#endregion
|
||||
ResolveCollision();
|
||||
}
|
||||
|
||||
Refresh();
|
||||
|
@ -143,6 +130,12 @@ namespace Switch_Toolbox.Library.Forms
|
|||
{
|
||||
currentFrame = Math.Min(Math.Max(0, (int)Math.Round(((e.Location.X - 20) * (frameRight - frameLeft) / (Width - 40.0) + frameLeft))), frameCount);
|
||||
FrameChanged?.Invoke(this, new EventArgs());
|
||||
|
||||
double delta = e.Location.X * (frameRight - frameLeft) / (Width - 40.0);
|
||||
frameLeft -= delta;
|
||||
frameRight -= delta;
|
||||
|
||||
ResolveCollision();
|
||||
Refresh();
|
||||
}
|
||||
else if (e.Button == MouseButtons.Right)
|
||||
|
@ -151,19 +144,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||
frameLeft -= delta;
|
||||
frameRight -= delta;
|
||||
|
||||
#region resolve collsions
|
||||
if (frameLeft < 0)
|
||||
{
|
||||
frameRight -= frameLeft;
|
||||
frameLeft = 0;
|
||||
}
|
||||
else if (frameRight > frameCount)
|
||||
{
|
||||
frameLeft += frameCount - frameRight;
|
||||
frameRight = frameCount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
ResolveCollision();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
@ -181,7 +162,14 @@ namespace Switch_Toolbox.Library.Forms
|
|||
frameLeft = Math.Min(-1, (frameLeft - frameOrigin)) * delta + frameOrigin;
|
||||
frameRight = Math.Max(1, (frameRight - frameOrigin)) * delta + frameOrigin;
|
||||
|
||||
#region resolve collsions
|
||||
ResolveCollision();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#region resolve collsions
|
||||
private void ResolveCollision()
|
||||
{
|
||||
if (frameLeft < 0)
|
||||
{
|
||||
frameRight -= frameLeft;
|
||||
|
@ -196,10 +184,8 @@ namespace Switch_Toolbox.Library.Forms
|
|||
frameLeft = 0;
|
||||
frameRight = frameCount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Refresh();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
|
@ -210,5 +196,9 @@ namespace Switch_Toolbox.Library.Forms
|
|||
return cp;
|
||||
}
|
||||
}
|
||||
|
||||
private void TimeLine_Resize(object sender, EventArgs e) {
|
||||
ResolveCollision();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
120
Switch_Toolbox_Library/Forms/Editors/TimeLine.resx
Normal file
120
Switch_Toolbox_Library/Forms/Editors/TimeLine.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
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
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<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
|
||||
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
|
||||
mimetype set.
|
||||
|
||||
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
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
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
|
||||
: 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
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -697,6 +697,9 @@
|
|||
<EmbeddedResource Include="Forms\Editors\TextEditor\TextEditorForm.resx">
|
||||
<DependentUpon>TextEditorForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Editors\TimeLine.resx">
|
||||
<DependentUpon>TimeLine.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Editors\TransformMeshTool.resx">
|
||||
<DependentUpon>TransformMeshTool.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
Loading…
Reference in a new issue