diff --git a/SpriteLibrary/SpriteEntryForm.Designer.cs b/SpriteLibrary/SpriteEntryForm.Designer.cs index 0263fdc..d494504 100644 --- a/SpriteLibrary/SpriteEntryForm.Designer.cs +++ b/SpriteLibrary/SpriteEntryForm.Designer.cs @@ -47,27 +47,27 @@ this.btnBack = new System.Windows.Forms.Button(); this.btnFwd = new System.Windows.Forms.Button(); this.lblCountSprites = new System.Windows.Forms.Label(); - this.tpRotateMirror = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.panel1 = new System.Windows.Forms.Panel(); - this.rbFromImage = new System.Windows.Forms.RadioButton(); - this.rbRotation = new System.Windows.Forms.RadioButton(); + this.TCTabPages = new System.Windows.Forms.TabControl(); + this.tpFromImage = new System.Windows.Forms.TabPage(); + this.tpMirrorRotate = new System.Windows.Forms.TabPage(); + this.cbMirrorH = new System.Windows.Forms.CheckBox(); + this.cbMirrorV = new System.Windows.Forms.CheckBox(); + this.lblRotationDegrees = new System.Windows.Forms.Label(); + this.tbRotation = new System.Windows.Forms.TextBox(); + this.lblWhichAnim = new System.Windows.Forms.Label(); + this.cbAnimation = new System.Windows.Forms.ComboBox(); + this.panelRadioButtons = new System.Windows.Forms.Panel(); this.rbMirror = new System.Windows.Forms.RadioButton(); + this.rbRotation = new System.Windows.Forms.RadioButton(); + this.rbFromImage = new System.Windows.Forms.RadioButton(); this.btnNewAnimation = new System.Windows.Forms.Button(); this.pbPreview = new System.Windows.Forms.PictureBox(); this.btnPreview = new System.Windows.Forms.Button(); - this.cbAnimation = new System.Windows.Forms.ComboBox(); - this.lblWhichAnim = new System.Windows.Forms.Label(); - this.tbRotation = new System.Windows.Forms.TextBox(); - this.lblRotationDegrees = new System.Windows.Forms.Label(); - this.cbMirrorV = new System.Windows.Forms.CheckBox(); - this.cbMirrorH = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.pbImageField)).BeginInit(); - this.tpRotateMirror.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.panel1.SuspendLayout(); + this.TCTabPages.SuspendLayout(); + this.tpFromImage.SuspendLayout(); + this.tpMirrorRotate.SuspendLayout(); + this.panelRadioButtons.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbPreview)).BeginInit(); this.SuspendLayout(); // @@ -180,7 +180,7 @@ // // tbAmimationSpeed // - this.tbAmimationSpeed.Location = new System.Drawing.Point(356, 207); + this.tbAmimationSpeed.Location = new System.Drawing.Point(356, 217); this.tbAmimationSpeed.Name = "tbAmimationSpeed"; this.tbAmimationSpeed.Size = new System.Drawing.Size(100, 22); this.tbAmimationSpeed.TabIndex = 12; @@ -188,7 +188,7 @@ // lblAnimationSpeed // this.lblAnimationSpeed.AutoSize = true; - this.lblAnimationSpeed.Location = new System.Drawing.Point(235, 210); + this.lblAnimationSpeed.Location = new System.Drawing.Point(235, 220); this.lblAnimationSpeed.Name = "lblAnimationSpeed"; this.lblAnimationSpeed.Size = new System.Drawing.Size(115, 17); this.lblAnimationSpeed.TabIndex = 13; @@ -240,67 +240,120 @@ this.lblCountSprites.TabIndex = 18; this.lblCountSprites.Text = "0"; // - // tpRotateMirror + // TCTabPages // - this.tpRotateMirror.Controls.Add(this.tabPage1); - this.tpRotateMirror.Controls.Add(this.tabPage2); - this.tpRotateMirror.Location = new System.Drawing.Point(224, 58); - this.tpRotateMirror.Name = "tpRotateMirror"; - this.tpRotateMirror.SelectedIndex = 0; - this.tpRotateMirror.Size = new System.Drawing.Size(282, 143); - this.tpRotateMirror.TabIndex = 19; + this.TCTabPages.Controls.Add(this.tpFromImage); + this.TCTabPages.Controls.Add(this.tpMirrorRotate); + this.TCTabPages.Location = new System.Drawing.Point(224, 68); + this.TCTabPages.Name = "TCTabPages"; + this.TCTabPages.SelectedIndex = 0; + this.TCTabPages.Size = new System.Drawing.Size(282, 143); + this.TCTabPages.TabIndex = 19; // - // tabPage1 + // tpFromImage // - this.tabPage1.Controls.Add(this.cbStartingImage); - this.tabPage1.Controls.Add(this.lblStartingImage); - this.tabPage1.Controls.Add(this.lblChosenArea); - this.tabPage1.Controls.Add(this.tbNumFrames); - this.tabPage1.Controls.Add(this.lblFrames); - this.tabPage1.Location = new System.Drawing.Point(4, 25); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(274, 114); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "tpFromImage"; - this.tabPage1.UseVisualStyleBackColor = true; + this.tpFromImage.Controls.Add(this.cbStartingImage); + this.tpFromImage.Controls.Add(this.lblStartingImage); + this.tpFromImage.Controls.Add(this.lblChosenArea); + this.tpFromImage.Controls.Add(this.tbNumFrames); + this.tpFromImage.Controls.Add(this.lblFrames); + this.tpFromImage.Location = new System.Drawing.Point(4, 25); + this.tpFromImage.Name = "tpFromImage"; + this.tpFromImage.Padding = new System.Windows.Forms.Padding(3); + this.tpFromImage.Size = new System.Drawing.Size(274, 114); + this.tpFromImage.TabIndex = 0; + this.tpFromImage.Text = "From Image"; + this.tpFromImage.UseVisualStyleBackColor = true; // - // tabPage2 + // tpMirrorRotate // - this.tabPage2.Controls.Add(this.cbMirrorH); - this.tabPage2.Controls.Add(this.cbMirrorV); - this.tabPage2.Controls.Add(this.lblRotationDegrees); - this.tabPage2.Controls.Add(this.tbRotation); - this.tabPage2.Controls.Add(this.lblWhichAnim); - this.tabPage2.Controls.Add(this.cbAnimation); - this.tabPage2.Location = new System.Drawing.Point(4, 25); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(274, 114); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "tabPage2"; - this.tabPage2.UseVisualStyleBackColor = true; + this.tpMirrorRotate.Controls.Add(this.cbMirrorH); + this.tpMirrorRotate.Controls.Add(this.cbMirrorV); + this.tpMirrorRotate.Controls.Add(this.lblRotationDegrees); + this.tpMirrorRotate.Controls.Add(this.tbRotation); + this.tpMirrorRotate.Controls.Add(this.lblWhichAnim); + this.tpMirrorRotate.Controls.Add(this.cbAnimation); + this.tpMirrorRotate.Location = new System.Drawing.Point(4, 25); + this.tpMirrorRotate.Name = "tpMirrorRotate"; + this.tpMirrorRotate.Padding = new System.Windows.Forms.Padding(3); + this.tpMirrorRotate.Size = new System.Drawing.Size(274, 114); + this.tpMirrorRotate.TabIndex = 1; + this.tpMirrorRotate.Text = "Mirror / Rotation"; + this.tpMirrorRotate.UseVisualStyleBackColor = true; // - // panel1 + // cbMirrorH // - this.panel1.Controls.Add(this.rbMirror); - this.panel1.Controls.Add(this.rbRotation); - this.panel1.Controls.Add(this.rbFromImage); - this.panel1.Location = new System.Drawing.Point(224, 31); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(277, 27); - this.panel1.TabIndex = 20; + this.cbMirrorH.AutoSize = true; + this.cbMirrorH.Location = new System.Drawing.Point(35, 87); + this.cbMirrorH.Name = "cbMirrorH"; + this.cbMirrorH.Size = new System.Drawing.Size(81, 21); + this.cbMirrorH.TabIndex = 5; + this.cbMirrorH.Text = "Mirror H"; + this.cbMirrorH.UseVisualStyleBackColor = true; // - // rbFromImage + // cbMirrorV // - this.rbFromImage.AutoSize = true; - this.rbFromImage.Location = new System.Drawing.Point(14, 3); - this.rbFromImage.Name = "rbFromImage"; - this.rbFromImage.Size = new System.Drawing.Size(103, 21); - this.rbFromImage.TabIndex = 0; - this.rbFromImage.TabStop = true; - this.rbFromImage.Text = "From Image"; - this.rbFromImage.UseVisualStyleBackColor = true; + this.cbMirrorV.AutoSize = true; + this.cbMirrorV.Location = new System.Drawing.Point(148, 87); + this.cbMirrorV.Name = "cbMirrorV"; + this.cbMirrorV.Size = new System.Drawing.Size(80, 21); + this.cbMirrorV.TabIndex = 4; + this.cbMirrorV.Text = "Mirror V"; + this.cbMirrorV.UseVisualStyleBackColor = true; + // + // lblRotationDegrees + // + this.lblRotationDegrees.AutoSize = true; + this.lblRotationDegrees.Location = new System.Drawing.Point(54, 61); + this.lblRotationDegrees.Name = "lblRotationDegrees"; + this.lblRotationDegrees.Size = new System.Drawing.Size(62, 17); + this.lblRotationDegrees.TabIndex = 3; + this.lblRotationDegrees.Text = "Degrees"; + // + // tbRotation + // + this.tbRotation.Location = new System.Drawing.Point(128, 58); + this.tbRotation.Name = "tbRotation"; + this.tbRotation.Size = new System.Drawing.Size(100, 22); + this.tbRotation.TabIndex = 2; + // + // lblWhichAnim + // + this.lblWhichAnim.AutoSize = true; + this.lblWhichAnim.Location = new System.Drawing.Point(38, 8); + this.lblWhichAnim.Name = "lblWhichAnim"; + this.lblWhichAnim.Size = new System.Drawing.Size(78, 34); + this.lblWhichAnim.TabIndex = 1; + this.lblWhichAnim.Text = "Based Off\r\nAnimation#"; + // + // cbAnimation + // + this.cbAnimation.FormattingEnabled = true; + this.cbAnimation.Location = new System.Drawing.Point(128, 18); + this.cbAnimation.Name = "cbAnimation"; + this.cbAnimation.Size = new System.Drawing.Size(100, 24); + this.cbAnimation.TabIndex = 0; + // + // panelRadioButtons + // + this.panelRadioButtons.Controls.Add(this.rbMirror); + this.panelRadioButtons.Controls.Add(this.rbRotation); + this.panelRadioButtons.Controls.Add(this.rbFromImage); + this.panelRadioButtons.Location = new System.Drawing.Point(224, 35); + this.panelRadioButtons.Name = "panelRadioButtons"; + this.panelRadioButtons.Size = new System.Drawing.Size(277, 27); + this.panelRadioButtons.TabIndex = 20; + // + // rbMirror + // + this.rbMirror.AutoSize = true; + this.rbMirror.Location = new System.Drawing.Point(197, 3); + this.rbMirror.Name = "rbMirror"; + this.rbMirror.Size = new System.Drawing.Size(66, 21); + this.rbMirror.TabIndex = 2; + this.rbMirror.TabStop = true; + this.rbMirror.Text = "Mirror"; + this.rbMirror.UseVisualStyleBackColor = true; // // rbRotation // @@ -313,16 +366,16 @@ this.rbRotation.Text = "Rotate"; this.rbRotation.UseVisualStyleBackColor = true; // - // rbMirror + // rbFromImage // - this.rbMirror.AutoSize = true; - this.rbMirror.Location = new System.Drawing.Point(197, 3); - this.rbMirror.Name = "rbMirror"; - this.rbMirror.Size = new System.Drawing.Size(66, 21); - this.rbMirror.TabIndex = 2; - this.rbMirror.TabStop = true; - this.rbMirror.Text = "Mirror"; - this.rbMirror.UseVisualStyleBackColor = true; + this.rbFromImage.AutoSize = true; + this.rbFromImage.Location = new System.Drawing.Point(14, 3); + this.rbFromImage.Name = "rbFromImage"; + this.rbFromImage.Size = new System.Drawing.Size(103, 21); + this.rbFromImage.TabIndex = 0; + this.rbFromImage.TabStop = true; + this.rbFromImage.Text = "From Image"; + this.rbFromImage.UseVisualStyleBackColor = true; // // btnNewAnimation // @@ -350,59 +403,6 @@ this.btnPreview.Text = "Preview"; this.btnPreview.UseVisualStyleBackColor = true; // - // cbAnimation - // - this.cbAnimation.FormattingEnabled = true; - this.cbAnimation.Location = new System.Drawing.Point(128, 18); - this.cbAnimation.Name = "cbAnimation"; - this.cbAnimation.Size = new System.Drawing.Size(100, 24); - this.cbAnimation.TabIndex = 0; - // - // lblWhichAnim - // - this.lblWhichAnim.AutoSize = true; - this.lblWhichAnim.Location = new System.Drawing.Point(38, 8); - this.lblWhichAnim.Name = "lblWhichAnim"; - this.lblWhichAnim.Size = new System.Drawing.Size(78, 34); - this.lblWhichAnim.TabIndex = 1; - this.lblWhichAnim.Text = "Based Off\r\nAnimation#"; - // - // tbRotation - // - this.tbRotation.Location = new System.Drawing.Point(128, 58); - this.tbRotation.Name = "tbRotation"; - this.tbRotation.Size = new System.Drawing.Size(100, 22); - this.tbRotation.TabIndex = 2; - // - // lblRotationDegrees - // - this.lblRotationDegrees.AutoSize = true; - this.lblRotationDegrees.Location = new System.Drawing.Point(54, 61); - this.lblRotationDegrees.Name = "lblRotationDegrees"; - this.lblRotationDegrees.Size = new System.Drawing.Size(62, 17); - this.lblRotationDegrees.TabIndex = 3; - this.lblRotationDegrees.Text = "Degrees"; - // - // cbMirrorV - // - this.cbMirrorV.AutoSize = true; - this.cbMirrorV.Location = new System.Drawing.Point(148, 87); - this.cbMirrorV.Name = "cbMirrorV"; - this.cbMirrorV.Size = new System.Drawing.Size(80, 21); - this.cbMirrorV.TabIndex = 4; - this.cbMirrorV.Text = "Mirror V"; - this.cbMirrorV.UseVisualStyleBackColor = true; - // - // cbMirrorH - // - this.cbMirrorH.AutoSize = true; - this.cbMirrorH.Location = new System.Drawing.Point(35, 87); - this.cbMirrorH.Name = "cbMirrorH"; - this.cbMirrorH.Size = new System.Drawing.Size(81, 21); - this.cbMirrorH.TabIndex = 5; - this.cbMirrorH.Text = "Mirror H"; - this.cbMirrorH.UseVisualStyleBackColor = true; - // // SpriteEntryForm // this.AcceptButton = this.btnApply; @@ -413,8 +413,8 @@ this.Controls.Add(this.btnPreview); this.Controls.Add(this.pbPreview); this.Controls.Add(this.btnNewAnimation); - this.Controls.Add(this.panel1); - this.Controls.Add(this.tpRotateMirror); + this.Controls.Add(this.panelRadioButtons); + this.Controls.Add(this.TCTabPages); this.Controls.Add(this.lblCountSprites); this.Controls.Add(this.btnFwd); this.Controls.Add(this.btnBack); @@ -436,13 +436,13 @@ this.Text = "SpriteEntryForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpriteEntryForm_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.pbImageField)).EndInit(); - this.tpRotateMirror.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); + this.TCTabPages.ResumeLayout(false); + this.tpFromImage.ResumeLayout(false); + this.tpFromImage.PerformLayout(); + this.tpMirrorRotate.ResumeLayout(false); + this.tpMirrorRotate.PerformLayout(); + this.panelRadioButtons.ResumeLayout(false); + this.panelRadioButtons.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbPreview)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -470,10 +470,10 @@ private System.Windows.Forms.Button btnBack; private System.Windows.Forms.Button btnFwd; private System.Windows.Forms.Label lblCountSprites; - private System.Windows.Forms.TabControl tpRotateMirror; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TabControl TCTabPages; + private System.Windows.Forms.TabPage tpFromImage; + private System.Windows.Forms.TabPage tpMirrorRotate; + private System.Windows.Forms.Panel panelRadioButtons; private System.Windows.Forms.RadioButton rbMirror; private System.Windows.Forms.RadioButton rbRotation; private System.Windows.Forms.RadioButton rbFromImage; diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs index 0900b98..f2c449b 100644 --- a/SpriteLibrary/SpriteEntryForm.cs +++ b/SpriteLibrary/SpriteEntryForm.cs @@ -41,8 +41,10 @@ namespace SpriteLibrary { pbImageField.BackgroundImageLayout = ImageLayout.Stretch; MyController = new SpriteController(pbImageField); - UpdateMenu(); PopulateMenu(); + UpdateMenu(); + SpriteInformationToForm(); + UpdateMenu(); } internal List GetUpdatedList() @@ -76,8 +78,38 @@ namespace SpriteLibrary private void UpdateMenu() { + SuspendLayout(); lblCountSprites.Text = SpriteInformation.Count.ToString(); if (TempInformation == null) SetUpEmptyInfo(); + + //Put in numbers into the combo-box of which frame to base ourselves off of + cbAnimation.Items.Clear(); + for(int i =0; i < TempInformation.Animations.Count; i++) + { + cbAnimation.Items.Add(i.ToString()); + } + if (CurrentSIAnimation == 0) + { + rbFromImage.Checked = true; + panelRadioButtons.Visible = false; + } + else + panelRadioButtons.Visible = true; + if(rbFromImage.Checked) + { + if(!TCTabPages.TabPages.Contains(tpFromImage)) + TCTabPages.TabPages.Add(tpFromImage); + if (TCTabPages.TabPages.Contains(tpMirrorRotate)) + TCTabPages.TabPages.Remove(tpMirrorRotate); + } + else + { + if (TCTabPages.TabPages.Contains(tpFromImage)) + TCTabPages.TabPages.Remove(tpFromImage); + if (!TCTabPages.TabPages.Contains(tpMirrorRotate)) + TCTabPages.TabPages.Add(tpMirrorRotate); + } + ResumeLayout(); } private void SetUpEmptyInfo() @@ -91,7 +123,6 @@ namespace SpriteLibrary AI.Height = 100; AI.Width = 100; AI.StartPoint = new Point(0, 0); - AI.ViewPercent = 100; TempInformation.Animations.Add(AI); } @@ -114,6 +145,36 @@ namespace SpriteLibrary } } + /// + /// Take the values stored in TempInformation and push it out to our form + /// + private void SpriteInformationToForm() + { + if (TempInformation == null) return; + //For the main sprite information + tbSpriteName.Text = TempInformation.SpriteName; + tbDefaultSize.Text = TempInformation.ViewPercent.ToString(); + + //From the current animation + AnimationInfo AI = null; + if (CurrentSIAnimation < 0) CurrentSIAnimation = 0; + if (CurrentSIAnimation >= TempInformation.Animations.Count) CurrentSIAnimation = TempInformation.Animations.Count -1; + if (CurrentSIAnimation < TempInformation.Animations.Count) + { + AI = TempInformation.Animations[CurrentSIAnimation]; + tbAmimationSpeed.Text = AI.AnimSpeed.ToString(); + cbStartingImage.Text = AI.ImageName; + cbMirrorH.Checked = AI.MirrorHorizontally; + cbMirrorV.Checked = AI.MirrorVertically; + cbAnimation.Text = AI.AnimationToUse.ToString(); + tbNumFrames.Text = AI.NumFrames.ToString(); + //Radio buttons + if (AI.FieldsToUse == AnimationType.SpriteDefinition) rbFromImage.Checked = true; + if (AI.FieldsToUse == AnimationType.Mirror) rbMirror.Checked = true; + if (AI.FieldsToUse == AnimationType.Rotation) rbRotation.Checked = true; + } + } + private void SpriteEntryForm_FormClosing(object sender, FormClosingEventArgs e) { myDatabase.Save(); //try saving the file diff --git a/SpriteLibrary/SpriteInfo.cs b/SpriteLibrary/SpriteInfo.cs index 6e313c1..1e3754a 100644 --- a/SpriteLibrary/SpriteInfo.cs +++ b/SpriteLibrary/SpriteInfo.cs @@ -21,9 +21,8 @@ namespace SpriteLibrary public string ImageName = ""; public int Width = -1; public int Height = -1; - public int AnimSpeed = 200; public int NumFrames = 1; - public int ViewPercent = 100; //The percent size of the sprite. 100 is full. 50 is half-size + public int AnimSpeed = 200; /// /// A generic cloning method that works when everything is public @@ -40,7 +39,7 @@ namespace SpriteLibrary internal string SpriteName = ""; internal int ViewPercent = 100; //The percent size of the sprite. 100 is full. 50 is half-size internal List Animations = new List(); - + /// /// A generic cloning method that works when everything is public ///