more work on the form
This commit is contained in:
@ -41,8 +41,10 @@ namespace SpriteLibrary
|
||||
{
|
||||
pbImageField.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
MyController = new SpriteController(pbImageField);
|
||||
UpdateMenu();
|
||||
PopulateMenu();
|
||||
UpdateMenu();
|
||||
SpriteInformationToForm();
|
||||
UpdateMenu();
|
||||
}
|
||||
|
||||
internal List<SpriteInfo> 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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Take the values stored in TempInformation and push it out to our form
|
||||
/// </summary>
|
||||
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
|
||||
|
Reference in New Issue
Block a user