/// <summary>
        /// Called when we want to undo a change in the model.
        /// </summary>
        /// <param name="clearUndoneModel">Set to false if you want it to
        /// be possible to redo the action.</param>
        internal void Undo(Boolean clearUndoneModel)
        {
            ModelHistoryItem historyItem = mModelHistory.Undo(clearUndoneModel);
              if (historyItem != null)
              {
            mPlayModel = historyItem.model;
            viewPanel.CurrentFrame = mPlayModel.GetFrame(viewPanel.CurrentFrame.UniqueId);
            if (viewPanel.CurrentFrame == null)
            {
              viewPanel.CurrentFrame = mPlayModel.FirstFrame();
            }
            viewPanel.Refresh();

            // Need to tell the frame collection that the model has changed as well
            // since it usually finds out from the ModelChanged function of the
            // main designer form (which isn't called during an undo).
            frameCollection.ModelChanged(mPlayModel);
            frameCollection.CurrentFrameChanged(viewPanel.CurrentFrame);
              }

              // Each time the model changes we check to see whether the undo/redo
              // buttons should be greyed out.
              undoToolStripMenuItem.Enabled = mModelHistory.CanUndo();
              redoToolStripMenuItem.Enabled = mModelHistory.CanRedo();
        }
        /// <summary>
        /// External load routine. Needs to be internal so that it can be called
        /// from the application wide key handler.
        /// </summary>
        internal void LoadPlay()
        {
            using (OpenFileDialog openDialog = new OpenFileDialog())
              {
            openDialog.CheckFileExists = true;
            openDialog.CheckPathExists = true;
            openDialog.Multiselect = false;
            openDialog.Title = "Open Play";
            openDialog.AddExtension = true;
            openDialog.Filter = "Play (*.ply)|*.ply";

            if (openDialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
              using (Stream fileStream = openDialog.OpenFile())
              {
            BinaryFormatter bin = new BinaryFormatter();
            mPlayModel = (PlayModel)bin.Deserialize(fileStream);
              }

              frameCollection.ModelChanged(mPlayModel);
              ChangeDisplayedFrame(mPlayModel.FirstFrame());

              // Clear the history as this is a completely new play model.
              mModelHistory.Clear();
              mModelHistory.ModelChange(mPlayModel);
            }
              }
        }