Skip to content
Snippets Groups Projects
Commit 0257df1b authored by Nick Kozel's avatar Nick Kozel
Browse files

adding playback speed option

parent b60b7a25
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
this.BMP = new System.Windows.Forms.MenuItem(); this.BMP = new System.Windows.Forms.MenuItem();
this.TIFF = new System.Windows.Forms.MenuItem(); this.TIFF = new System.Windows.Forms.MenuItem();
this.menuFileSaveAs = new System.Windows.Forms.MenuItem(); this.menuFileSaveAs = new System.Windows.Forms.MenuItem();
this.menuHelp = new System.Windows.Forms.MenuItem();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
...@@ -49,8 +50,11 @@ ...@@ -49,8 +50,11 @@
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.saveGifFileDialog = new System.Windows.Forms.SaveFileDialog(); this.saveGifFileDialog = new System.Windows.Forms.SaveFileDialog();
this.menuHelp = new System.Windows.Forms.MenuItem(); this.trackBar1 = new System.Windows.Forms.TrackBar();
this.label4 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// openGifFileDialog // openGifFileDialog
...@@ -128,6 +132,12 @@ ...@@ -128,6 +132,12 @@
this.menuFileSaveAs.Text = "Save as..."; this.menuFileSaveAs.Text = "Save as...";
this.menuFileSaveAs.Click += new System.EventHandler(this.MenuItemFileSaveAs); this.menuFileSaveAs.Click += new System.EventHandler(this.MenuItemFileSaveAs);
// //
// menuHelp
//
this.menuHelp.Index = 1;
this.menuHelp.Text = "Help";
this.menuHelp.Click += new System.EventHandler(this.menuOpenHelp);
//
// textBox1 // textBox1
// //
this.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
...@@ -198,17 +208,46 @@ ...@@ -198,17 +208,46 @@
this.timer1.Interval = 20; this.timer1.Interval = 20;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// menuHelp // trackBar1
// //
this.menuHelp.Index = 1; this.trackBar1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.menuHelp.Text = "Help"; this.trackBar1.Location = new System.Drawing.Point(437, 561);
this.menuHelp.Click += new System.EventHandler(this.menuOpenHelp); this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(183, 56);
this.trackBar1.TabIndex = 9;
this.trackBar1.Value = 10;
this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(478, 551);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(110, 17);
this.label4.TabIndex = 10;
this.label4.Text = "Playback Speed";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.label6.AutoSize = true;
this.label6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F);
this.label6.Location = new System.Drawing.Point(87, 560);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 29);
this.label6.TabIndex = 12;
this.label6.Text = "GIFITTI";
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(632, 577); this.ClientSize = new System.Drawing.Size(632, 577);
this.Controls.Add(this.label6);
this.Controls.Add(this.label4);
this.Controls.Add(this.trackBar1);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
...@@ -223,6 +262,7 @@ ...@@ -223,6 +262,7 @@
this.Text = "Gifitti"; this.Text = "Gifitti";
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.gifView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gifView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -253,6 +293,9 @@ ...@@ -253,6 +293,9 @@
private System.Windows.Forms.SaveFileDialog saveGifFileDialog; private System.Windows.Forms.SaveFileDialog saveGifFileDialog;
private System.Windows.Forms.MenuItem menuOpenFile; private System.Windows.Forms.MenuItem menuOpenFile;
private System.Windows.Forms.MenuItem menuHelp; private System.Windows.Forms.MenuItem menuHelp;
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label6;
} }
} }
...@@ -10,6 +10,7 @@ using System.Text; ...@@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Gifitti.Models; using Gifitti.Models;
using System.Threading;
namespace Gifitti.View_Models namespace Gifitti.View_Models
{ {
...@@ -17,6 +18,7 @@ namespace Gifitti.View_Models ...@@ -17,6 +18,7 @@ namespace Gifitti.View_Models
{ {
#region Fields #region Fields
GifModel gm; GifModel gm;
int delay = 0;
// GifImage _currentGif; <- used to encapsulate info later // GifImage _currentGif; <- used to encapsulate info later
private const int widthBuffer = 20; private const int widthBuffer = 20;
...@@ -227,6 +229,7 @@ namespace Gifitti.View_Models ...@@ -227,6 +229,7 @@ namespace Gifitti.View_Models
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
//get next frame //get next frame
Thread.Sleep(delay);
gifView.Image = gm.GetNextFrame(); gifView.Image = gm.GetNextFrame();
} }
...@@ -331,5 +334,10 @@ namespace Gifitti.View_Models ...@@ -331,5 +334,10 @@ namespace Gifitti.View_Models
Form2 f2 = new Form2(); Form2 f2 = new Form2();
f2.Show(); f2.Show();
} }
private void trackBar1_ValueChanged(object sender, EventArgs e)
{
delay = (10-trackBar1.Value)*10;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment