//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: master.h,v 1.1.1.1 2003/10/29 10:06:13 wschweer Exp $
//  (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================

#ifndef __MASTER_H__
#define __MASTER_H__

#include <qpoint.h>

#include "view.h"
#include "song.h"
#include "tools.h"

class ScrollScale;
class QPainter;
class QRect;
class MidiEditor;

//---------------------------------------------------------
//   Master
//---------------------------------------------------------

class Master : public View {
      enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE,
            DRAG_DELETE, DRAG_COPY_START, DRAG_COPY,
            DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO
            };
      ScrollScale* vscroll;
      int pos[3];
      QPoint start;
      Tool tool;
      DragMode drag;
      MidiEditor* editor;

      Q_OBJECT
      virtual void pdraw(QPainter&, const QRect&);
      virtual void viewMouseMoveEvent(QMouseEvent* event);
      virtual void leaveEvent(QEvent*e);
      virtual void viewMousePressEvent(QMouseEvent* event);
      virtual void viewMouseReleaseEvent(QMouseEvent*);

      void draw(QPainter&, const QRect&);
      void newVal(int x1, int x2, int y);
      bool deleteVal1(int x1, int x2);
      void deleteVal(int x1, int x2);

   signals:
      void followEvent(int);
      void xposChanged(int);
      void yposChanged(int);
      void timeChanged(int);
      void tempoChanged(int);

   public slots:
      void setPos(int, int, bool adjustScrollbar);
      void setTool(int t);

   public:
      Master(MidiEditor*, QWidget* parent, int xmag, int ymag);
      };

#endif

