//=========================================================
//  MusE
//  Linux Music Editor
//  $Id: undo.h,v 1.6.2.1 2004/12/28 23:20:44 lunar_shuttle Exp $
//
//  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//=========================================================

#ifndef __UNDO_H__
#define __UNDO_H__

#include <list>
#include "event.h"

class Track;
class TEvent;
class SigEvent;
class Part;

//---------------------------------------------------------
//   UndoOp
//---------------------------------------------------------

struct UndoOp {
      enum UndoType {
            AddTrack, DeleteTrack, ModifyTrack,
            AddPart,  DeletePart,  ModifyPart,
            AddEvent, DeleteEvent, ModifyEvent,
            AddTempo, DeleteTempo,
            AddSig,   DeleteSig,
            SwapTrack
            };
      UndoType type;

      union {
            struct {
                  int a;
                  int b;
                  int c;
                  };
            struct {
                  Track* oTrack;
                  Track* nTrack;
                  int trackno;
                  };
            struct {
                  Part* oPart;
                  Part* nPart;
                  };
            struct {
                  Part* part;
                  };
            struct {
                  SigEvent* nSignature;
                  SigEvent* oSignature;
                  };
            struct {
                  int channel;
                  int ctrl;
                  int oVal;
                  int nVal;
                  };
            };
      Event oEvent;
      Event nEvent;
      const char* typeName();
      void dump();
      };

class Undo : public std::list<UndoOp> {
      void undoOp(UndoOp::UndoType, int data);
      };

typedef Undo::iterator iUndoOp;
typedef Undo::reverse_iterator riUndoOp;

class UndoList : public std::list<Undo> {
   public:
      };

typedef UndoList::iterator iUndo;


#endif // __UNDO_H__
