Skip to content
Snippets Groups Projects
Commit 12648346 authored by Riley Mcgee's avatar Riley Mcgee
Browse files

Prepared For merge closes #13

parent 5dd73f4c
No related branches found
No related tags found
No related merge requests found
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openGifFileDialog = new System.Windows.Forms.OpenFileDialog();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.gifView = new System.Windows.Forms.PictureBox(); this.gifView = new System.Windows.Forms.PictureBox();
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components); this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
this.menuItem1 = new System.Windows.Forms.MenuItem(); this.meneFile = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuFileExportAs = new System.Windows.Forms.MenuItem();
this.JPEG = new System.Windows.Forms.MenuItem(); this.JPEG = new System.Windows.Forms.MenuItem();
this.PNG = new System.Windows.Forms.MenuItem(); this.PNG = new System.Windows.Forms.MenuItem();
this.BMP = new System.Windows.Forms.MenuItem(); this.BMP = new System.Windows.Forms.MenuItem();
...@@ -51,16 +51,17 @@ ...@@ -51,16 +51,17 @@
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.menuFileSaveAs = new System.Windows.Forms.MenuItem();
this.saveGifFileDialog = new System.Windows.Forms.SaveFileDialog();
((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
// //
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Location = new System.Drawing.Point(9, 411); this.button1.Location = new System.Drawing.Point(14, 632);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 28); this.button1.Size = new System.Drawing.Size(156, 43);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Open GIF"; this.button1.Text = "Open GIF";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
...@@ -69,25 +70,24 @@ ...@@ -69,25 +70,24 @@
// button2 // button2
// //
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(323, 411); this.button2.Location = new System.Drawing.Point(484, 632);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(104, 28); this.button2.Size = new System.Drawing.Size(156, 43);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
this.button2.Text = "Save GIF"; this.button2.Text = "Save GIF";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// openFileDialog1 // openGifFileDialog
// //
this.openFileDialog1.FileName = "openFileDialog1"; this.openGifFileDialog.FileName = "openGifFileDialog";
this.openGifFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.openGifDialog_FileOk);
// //
// gifView // gifView
// //
this.gifView.Location = new System.Drawing.Point(9, 10); this.gifView.Location = new System.Drawing.Point(14, 15);
this.gifView.Margin = new System.Windows.Forms.Padding(2);
this.gifView.Name = "gifView"; this.gifView.Name = "gifView";
this.gifView.Size = new System.Drawing.Size(418, 396); this.gifView.Size = new System.Drawing.Size(627, 609);
this.gifView.TabIndex = 2; this.gifView.TabIndex = 2;
this.gifView.TabStop = false; this.gifView.TabStop = false;
// //
...@@ -95,48 +95,49 @@ ...@@ -95,48 +95,49 @@
// mainMenu1 // mainMenu1
// //
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1}); this.meneFile});
// //
// menuItem1 // meneFile
// //
this.menuItem1.Index = 0; this.meneFile.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.meneFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2}); this.menuFileExportAs,
this.menuItem1.Text = "File"; this.menuFileSaveAs});
this.meneFile.Text = "File";
// //
// menuItem2 // menuFileExportAs
// //
this.menuItem2.Index = 0; this.menuFileExportAs.Index = 0;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuFileExportAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.JPEG, this.JPEG,
this.PNG, this.PNG,
this.BMP, this.BMP,
this.TIFF}); this.TIFF});
this.menuItem2.Text = "Output As Image"; this.menuFileExportAs.Text = "Output As Image";
// //
// JPEG // JPEG
// //
this.JPEG.Index = 0; this.JPEG.Index = 0;
this.JPEG.Text = "JPEG"; this.JPEG.Text = "JPEG";
this.JPEG.Click += new System.EventHandler(this.menuItem3_Click); this.JPEG.Click += new System.EventHandler(this.MenuItemExportJPEG);
// //
// PNG // PNG
// //
this.PNG.Index = 1; this.PNG.Index = 1;
this.PNG.Text = "PNG"; this.PNG.Text = "PNG";
this.PNG.Click += new System.EventHandler(this.menuItem4_Click); this.PNG.Click += new System.EventHandler(this.MenuItemExportPNG);
// //
// BMP // BMP
// //
this.BMP.Index = 2; this.BMP.Index = 2;
this.BMP.Text = "BMP"; this.BMP.Text = "BMP";
this.BMP.Click += new System.EventHandler(this.menuItem5_Click); this.BMP.Click += new System.EventHandler(this.MenuItemExportBMP);
// //
// TIFF // TIFF
// //
this.TIFF.Index = 3; this.TIFF.Index = 3;
this.TIFF.Text = "TIFF"; this.TIFF.Text = "TIFF";
this.TIFF.Click += new System.EventHandler(this.menuItem6_Click); this.TIFF.Click += new System.EventHandler(this.MenuItemExportTIFF);
// textBox1 // textBox1
// //
...@@ -205,15 +206,19 @@ ...@@ -205,15 +206,19 @@
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);
this.TIFF.Click += new System.EventHandler(this.MenuItemExportTIFF);
//
// menuFileSaveAs
//
this.menuFileSaveAs.Index = 1;
this.menuFileSaveAs.Text = "Save as...";
this.menuFileSaveAs.Click += new System.EventHandler(this.MenuItemFileSaveAs);
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(436, 449);
this.ClientSize = new System.Drawing.Size(582, 553);
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);
...@@ -221,10 +226,11 @@ ...@@ -221,10 +226,11 @@
this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.ClientSize = new System.Drawing.Size(654, 691);
this.Controls.Add(this.gifView); this.Controls.Add(this.gifView);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(2);
this.Menu = this.mainMenu1; this.Menu = this.mainMenu1;
this.Name = "Form1"; this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
...@@ -240,13 +246,13 @@ ...@@ -240,13 +246,13 @@
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openGifFileDialog;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog;
private System.Windows.Forms.PictureBox gifView; private System.Windows.Forms.PictureBox gifView;
private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem meneFile;
private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuFileExportAs;
private System.Windows.Forms.MenuItem JPEG; private System.Windows.Forms.MenuItem JPEG;
private System.Windows.Forms.MenuItem PNG; private System.Windows.Forms.MenuItem PNG;
private System.Windows.Forms.MenuItem BMP; private System.Windows.Forms.MenuItem BMP;
...@@ -259,6 +265,10 @@ ...@@ -259,6 +265,10 @@
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.MenuItem menuFileSaveAs;
private System.Windows.Forms.SaveFileDialog saveGifFileDialog;
} }
} }
...@@ -15,13 +15,15 @@ namespace Gifitti.View_Models ...@@ -15,13 +15,15 @@ namespace Gifitti.View_Models
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
#region Fields
GifModel gm; GifModel gm;
// GifImage _currentGif; <- used to encapsulate info later // GifImage _currentGif; <- used to encapsulate info later
private const int widthBuffer = 20; private const int widthBuffer = 20;
private const int heightBuffer = 60; private const int heightBuffer = 60;
Image globalGif; Image globalGif;
#endregion
#region Constructors
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
...@@ -31,14 +33,15 @@ namespace Gifitti.View_Models ...@@ -31,14 +33,15 @@ namespace Gifitti.View_Models
{ {
} }
#endregion
#region Buttons
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
openFileDialog1.Filter = "GIF Files|*.gif"; openGifFileDialog.Filter = "GIF Files|*.gif";
DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. DialogResult result = openGifFileDialog.ShowDialog(); // Show the dialog.
if (result == DialogResult.OK) // Test result. if (result == DialogResult.OK) // Test result.
{ {
string file = openFileDialog1.FileName; string file = openGifFileDialog.FileName;
try try
{ {
gm = new GifModel(file); gm = new GifModel(file);
...@@ -80,9 +83,9 @@ namespace Gifitti.View_Models ...@@ -80,9 +83,9 @@ namespace Gifitti.View_Models
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
String x = ""; String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
x = folderBrowserDialog1.SelectedPath; x = folderBrowserDialog.SelectedPath;
} }
List<Image> IMGs = new List<Image>(); List<Image> IMGs = new List<Image>();
...@@ -100,6 +103,8 @@ namespace Gifitti.View_Models ...@@ -100,6 +103,8 @@ namespace Gifitti.View_Models
} }
} }
#endregion
#region SystemChecks
private Boolean chkImage() private Boolean chkImage()
{ {
Boolean check = true; Boolean check = true;
...@@ -115,14 +120,17 @@ namespace Gifitti.View_Models ...@@ -115,14 +120,17 @@ namespace Gifitti.View_Models
return (check); return (check);
} }
private void menuItem3_Click(object sender, EventArgs e) #endregion
#region MenuItems
private void MenuItemExportJPEG(object sender, EventArgs e)
{ {
if(chkImage()) if(chkImage())
{ {
String x = ""; String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
x = folderBrowserDialog1.SelectedPath; x = folderBrowserDialog.SelectedPath;
} }
List<Image> IMGs = new List<Image>(); List<Image> IMGs = new List<Image>();
...@@ -143,14 +151,14 @@ namespace Gifitti.View_Models ...@@ -143,14 +151,14 @@ namespace Gifitti.View_Models
} }
private void menuItem4_Click(object sender, EventArgs e) private void MenuItemExportPNG(object sender, EventArgs e)
{ {
if (chkImage()) if (chkImage())
{ {
String x = ""; String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
x = folderBrowserDialog1.SelectedPath; x = folderBrowserDialog.SelectedPath;
} }
List<Image> IMGs = new List<Image>(); List<Image> IMGs = new List<Image>();
...@@ -170,14 +178,14 @@ namespace Gifitti.View_Models ...@@ -170,14 +178,14 @@ namespace Gifitti.View_Models
} }
} }
private void menuItem5_Click(object sender, EventArgs e) private void MenuItemExportBMP(object sender, EventArgs e)
{ {
if (chkImage()) if (chkImage())
{ {
String x = ""; String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
x = folderBrowserDialog1.SelectedPath; x = folderBrowserDialog.SelectedPath;
} }
List<Image> IMGs = new List<Image>(); List<Image> IMGs = new List<Image>();
...@@ -197,14 +205,14 @@ namespace Gifitti.View_Models ...@@ -197,14 +205,14 @@ namespace Gifitti.View_Models
} }
} }
private void menuItem6_Click(object sender, EventArgs e) private void MenuItemExportTIFF(object sender, EventArgs e)
{ {
if (chkImage()) if (chkImage())
{ {
String x = ""; String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
x = folderBrowserDialog1.SelectedPath; x = folderBrowserDialog.SelectedPath;
} }
List<Image> IMGs = new List<Image>(); List<Image> IMGs = new List<Image>();
...@@ -254,5 +262,35 @@ namespace Gifitti.View_Models ...@@ -254,5 +262,35 @@ namespace Gifitti.View_Models
{ {
gm.endFrame = int.Parse(textBox2.Text); gm.endFrame = int.Parse(textBox2.Text);
} }
private void MenuItemFileSaveAs(object sender, EventArgs e)
{
if (!chkImage())
return;
String path = null;
saveGifFileDialog.Filter = "GIF Files|*.gif";
if (saveGifFileDialog.ShowDialog() == DialogResult.OK)
path = saveGifFileDialog.FileName;
//Handel Close
if (path.Equals(null))
return;
//TODO temp write
Console.WriteLine(path);
try {
gm.saveGif(path);
} catch (DirectoryNotFoundException)
{
MessageBox.Show("Save Path Invalid!");
}
}
#endregion
#region File Dialogs
private void openGifDialog_FileOk(object sender, CancelEventArgs e)
{
}
#endregion
} }
} }
...@@ -117,14 +117,17 @@ ...@@ -117,14 +117,17 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openGifFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value> <value>224, 17</value>
</metadata> </metadata>
<metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>353, 17</value> <value>452, 17</value>
</metadata>
<metadata name="saveGifFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>611, 17</value>
</metadata> </metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>388, 17</value> <value>388, 17</value>
......
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