/// <summary>
 /// Create an animation controller.
 /// </summary>
 public AnimationEditor(AnimationEditorScreen screen)
 {
     //Initialize some variables.
     Initialize(screen, null);
 }
 /// <summary>
 /// Create an animation controller.
 /// </summary>
 public AnimationEditor(AnimationEditorScreen screen, Character character)
 {
     //Initialize some variables.
     Initialize(screen, character);
 }
        /// <summary>
        /// Initialize the animation controller.
        /// </summary>
        public void Initialize(AnimationEditorScreen screen, Character character)
        {
            //Initialize some variables.
            _Screen = screen;
            _Character = character;
            _SelectedAnimation = ((_Character != null) && (_Character.Skeleton.Animations.Count != 0)) ? GetAnimation(0) : null;
            _AnimationBars = new List<AnimationBar>();
            _SelectedBoneIndex = 0;
            _ModifiedBone = new List<bool>();
            _GUI = new GraphicalUserInterface();
            _IsGUIClicked = false;

            //Create the character.
            _Character = new Character(new Level("redundant", null), "deafult", new Vector2(600, 250), 0, Vector2.One, 0, 0);
            _Character.Skeleton.Initialize(screen.ScreenManager.GraphicsDevice);
            _Character.AddAnimation();
            _Character.Skeleton.Animations[0].Name = "default pose";
            _Character.Skeleton.AddKeyframe(0, 0);
            _Character.Skeleton.AddKeyframe(0, 3);
            _Character.Skeleton.AddKeyframe(0, 8);
            _Character.Skeleton.AddKeyframe(0, 12);
            _Character.Skeleton.AddKeyframe(0, 15);
            _Character.Skeleton.AddKeyframe(0, 19);

            //Initialize the list of modified bones.
            ResetModifiedBones();

            //Add items to the GUI.
            _InformationList = new List(_GUI, new Vector2(950, 155), 300, 300);
            _AnimationList = new Checkboxlist(_GUI, new Vector2(950, 50), 300, 100);
            _Menu = new Menu(_GUI, new Vector2(0, 0), 500, 30);

            //Save some components closer to home.
            _GUI.AddItem(_InformationList);
            _GUI.AddItem(_AnimationList);
            _GUI.AddItem(_Menu);

            //Create the animation bars and update the animation lists.
            UpdateAnimationLists();
            UpdateInformationList(true);

            //Tinker with the animation.
            _SelectedAnimation.ResetKeyframe(0);

            //Hook up some events.
            _GUI.ItemClicked += OnGUIClicked;
            _InformationList.ItemSelect += OnInformationSelected;
            _AnimationList.ItemSelect += OnAnimationSelected;

            #region Menu
            //Play with the menu.
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();

            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();

            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();

            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();

            _Menu.MenuItems[0].IsScrollable = false;
            _Menu.MenuItems[1].IsScrollable = false;
            _Menu.MenuItems[2].IsScrollable = false;
            _Menu.MenuItems[0].IsFixed = false;
            _Menu.MenuItems[1].IsFixed = false;
            _Menu.MenuItems[2].IsFixed = false;

            _Menu.MenuItems[0].Text = "File";
            _Menu.MenuItems[1].Text = "Edit";
            _Menu.MenuItems[2].Text = "View";

            _Menu.MenuItems[0][0].Label.Text = "New Animation";
            _Menu.MenuItems[0][1].Label.Text = "New Skeleton";
            _Menu.MenuItems[0][2].Label.Text = "Open Animation";
            _Menu.MenuItems[0][3].Label.Text = "Open Skeleton";
            _Menu.MenuItems[0][4].Label.Text = "Save Animation";
            _Menu.MenuItems[0][5].Label.Text = "Save Skeleton";

            _Menu.MenuItems[1][0].Label.Text = "Create Bone";
            _Menu.MenuItems[1][1].Label.Text = "Edit Bone";
            _Menu.MenuItems[1][2].Label.Text = "Create Keyframe";
            _Menu.MenuItems[1][3].Label.Text = "Delete Keyframe";
            _Menu.MenuItems[1][4].Label.Text = "Remove Animation";

            _Menu.MenuItems[2][0].Label.Text = "Zoom";
            _Menu.MenuItems[2][1].Label.Text = "Scroll";
            _Menu.MenuItems[2][2].Label.Text = "Windows";

            _Menu.MenuOptionSelect += OnMenuOptionSelected;
            #endregion
        }