delete working + tooltips

This commit is contained in:
Tim Young 2017-09-20 11:18:31 -05:00
parent f363a9ba76
commit 35133e64b7
2 changed files with 41 additions and 2 deletions

View File

@ -519,6 +519,7 @@
this.btnDeleteAnim.TabIndex = 22; this.btnDeleteAnim.TabIndex = 22;
this.btnDeleteAnim.Text = "-"; this.btnDeleteAnim.Text = "-";
this.btnDeleteAnim.UseVisualStyleBackColor = true; this.btnDeleteAnim.UseVisualStyleBackColor = true;
this.btnDeleteAnim.Click += new System.EventHandler(this.btnDeleteAnim_Click);
// //
// btnDelSprite // btnDelSprite
// //
@ -528,6 +529,7 @@
this.btnDelSprite.TabIndex = 28; this.btnDelSprite.TabIndex = 28;
this.btnDelSprite.Text = "Del Sprite"; this.btnDelSprite.Text = "Del Sprite";
this.btnDelSprite.UseVisualStyleBackColor = true; this.btnDelSprite.UseVisualStyleBackColor = true;
this.btnDelSprite.Click += new System.EventHandler(this.btnDelSprite_Click);
// //
// SpriteEntryForm // SpriteEntryForm
// //

View File

@ -84,7 +84,9 @@ namespace SpriteLibrary
myToolTip.SetToolTip(btnFwd, "Move to next sprite."); myToolTip.SetToolTip(btnFwd, "Move to next sprite.");
myToolTip.SetToolTip(btnPreviewAnimBack, "Change preview to previous animation."); myToolTip.SetToolTip(btnPreviewAnimBack, "Change preview to previous animation.");
myToolTip.SetToolTip(btnPreviewAnimFwd, "Change preview to next animation."); myToolTip.SetToolTip(btnPreviewAnimFwd, "Change preview to next animation.");
myToolTip.SetToolTip(btnNewSprite, "Create a new sprite.");
myToolTip.SetToolTip(btnDeleteAnim, "Delete the current animation you are looking at.");
myToolTip.SetToolTip(btnDelSprite, "Delete the current sprite you are looking at.");
} }
internal List<SpriteInfo> GetUpdatedList() internal List<SpriteInfo> GetUpdatedList()
@ -514,7 +516,10 @@ namespace SpriteLibrary
private void WeHaveNewItem() private void WeHaveNewItem()
{ {
if (PreviewSprite != null) PreviewSprite.Destroy(); if (PreviewSprite != null) PreviewSprite.Destroy();
if (CurrentSIIndex >= 0 && CurrentSIIndex < SpriteInformation.Count)
TempInformation.CopyFrom(SpriteInformation[CurrentSIIndex]); TempInformation.CopyFrom(SpriteInformation[CurrentSIIndex]);
else
SetUpEmptyInfo();
SpriteInformationToForm(); SpriteInformationToForm();
UpdateMenu(); UpdateMenu();
} }
@ -647,5 +652,37 @@ namespace SpriteLibrary
{ {
SpriteInformationToForm(); SpriteInformationToForm();
} }
private void btnDelSprite_Click(object sender, EventArgs e)
{
if (CurrentSIIndex == -1)
{
//we are making a new sprite, but it has not been saved yet.
if (SpriteInformation.Count > 0)
{
CurrentSIIndex = 0;
WeHaveNewItem();
return;
}
//If we are here, then we have no sprites and we are deleting our temp one. Clear it out
SetUpEmptyInfo();
WeHaveNewItem();
return;
}
//delete the current entry. Deal with zero entries.
DialogResult Answer = MessageBox.Show("Delete The current Sprite?", "Delete", MessageBoxButtons.YesNo);
if(Answer == DialogResult.Yes)
{
SpriteInformation.RemoveAt(CurrentSIIndex);
CurrentSIIndex--;
if (CurrentSIIndex < 0 && SpriteInformation.Count > 0) CurrentSIIndex = 0;
WeHaveNewItem();
}
}
private void btnDeleteAnim_Click(object sender, EventArgs e)
{
}
} }
} }