/***************************************************************************
 * trackviewcommands.h: TrackEditCommand
 *                      InsertTabCommand
 *                      InsertNoteCommand
 *                      InsertBarCommand
 *
 * This file is part of KTabedit, a KDE tabulature editor
 *
 * copyright (C) 2003- the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#ifndef TRACKVIEWCOMMANDS_H
#define TRACKVIEWCOMMANDS_H

#include <QUndoCommand>

#include "trackeditview.h"

class TabTrackModel;
class TabBar;
class TabBend;
class TabNote;
class TabTime;

class TrackEditCommand : public QUndoCommand
{
public:
	TrackEditCommand(TabTrackModel* track, TrackPosModel* position, const QString& text);
	virtual ~TrackEditCommand();
	
	virtual void undo();
	virtual void redo();
	
	virtual TrackPosModel* position() const;
	virtual TabTrackModel* track() const;
private:
	const TrackPosModel* mOldPosition;
	TrackPosModel* mPosition;
	TabTrackModel* mTrack;
};

class TrackEditView::InsertTabCommand : public TrackEditCommand
{
public:
	InsertTabCommand(TabTrackModel* track, uchar fret, TrackPosModel* position);
	virtual ~InsertTabCommand();
	
	virtual void undo();
	virtual void redo();
private:
	TabNote* mOldNote;
	uchar mOldFret;
	uchar mFret;
};

class TrackEditView::InsertNoteCommand : public TrackEditCommand
{
public:
	InsertNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~InsertNoteCommand();
	
	virtual void undo();
	virtual void redo();
private:
};

class TrackEditView::InsertBarCommand : public TrackEditCommand
{
public:
	InsertBarCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~InsertBarCommand();
	
	virtual void undo();
	virtual void redo();
private:
};

class TrackEditView::DeleteNoteCommand : public TrackEditCommand
{
public:
	DeleteNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~DeleteNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	TabNote* mOldNote;
};

class TrackEditView::DeleteTimeCommand : public TrackEditCommand
{
public:
	DeleteTimeCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~DeleteTimeCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	TabTime* mOldTime;
};

class TrackEditView::DeleteBarCommand : public TrackEditCommand
{
public:
	DeleteBarCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~DeleteBarCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	TabBar* mOldBar;
};

class TrackEditView::SetLengthCommand : public TrackEditCommand
{
public:
	SetLengthCommand(TabTrackModel* track, Duration duration, TrackPosModel* position);
	virtual ~SetLengthCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const Duration mOldDuration;
	const Duration mDuration;
};

class TrackEditView::DottedNoteCommand : public TrackEditCommand
{
public:
	DottedNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~DottedNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasDotted;
};

class TrackEditView::RestNoteCommand : public TrackEditCommand
{
public:
	RestNoteCommand(TabTrackModel* tabTrack, TrackPosModel* position);
	virtual ~RestNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	bool mRest;
};

class TrackEditView::DeadNoteCommand : public TrackEditCommand {
public:
	DeadNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~DeadNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasDeadNote;
};

class TrackEditView::BendNoteCommand : public TrackEditCommand {
public:
	BendNoteCommand(TabTrackModel* track, TrackPosModel* position, const TabBend& bend);
	virtual ~BendNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	TabBend* mOldBend;
	TabBend* mBend;
};

class TrackEditView::GhostNoteCommand : public TrackEditCommand {
public:
	GhostNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~GhostNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasGhostNote;
};

class TrackEditView::TieNoteCommand : public TrackEditCommand {
public:
	TieNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~TieNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasTieNote;
};

class TrackEditView::HammerNoteCommand : public TrackEditCommand {
public:
	HammerNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~HammerNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasHammerNote;
};

class TrackEditView::LetRingNoteCommand : public TrackEditCommand {
public:
	LetRingNoteCommand(TabTrackModel* track, TrackPosModel* position);
	virtual ~LetRingNoteCommand();
	
	virtual void undo();
	virtual void redo();
	
private:
	const bool mWasLetRingNote;
};

/*class TrackEditView::MoveFingerCommand: public QUndoCommand {
public:
	MoveFingerCommand(TrackView *, TabTrack *, int _from, int _to, int _tune);
	virtual ~MoveFingerCommand();
	
	virtual void execute();
	virtual void unexecute();
	
private:
};

class TrackEditView::DeleteNoteCommand : public QUndoCommand {
public:
	DeleteNoteCommand(TrackEditView& tv, TabTrack& trk, TrackPos& pos);
	virtual ~DeleteNoteCommand();
	
	virtual void execute();
	virtual void unexecute();
	
private:
	TrackPos& currentPos;
	const TrackPos oldPos;
	TrackEditView &trackView;
	TabBar oldBar;
	TabTrack &tabTrack;
};

class TrackEditView::DeleteColumnCommand: public QUndoCommand {
public:
	DeleteColumnCommand(TrackEditView& tv, TabTrack& trk, TrackPos& pos);
	virtual ~DeleteColumnCommand();
	
	virtual void execute();
	virtual void unexecute();
	
private:
	TrackPos& currentPos, oldPos;
	int countBar;
	TabBar oldBar;
	TrackEditView& trackView;
	TabTrack& tabTrack;
};

class TrackEditView::SetTimeSigCommand : public QUndoCommand {
public:
	SetTimeSigCommand(TrackEditView& tv, TabTrack& trk, int _bar, bool _toend, int _time1, int _time2);
	virtual ~SetTimeSigCommand();
	
	virtual void execute();
	virtual void unexecute();

private:
	int bar, time1, time2;
	int oldTime1, oldTime2;
	int defaultOldTime1, defaultOldTime2;
	bool sel, toend;
	TabTrack& tabTrack;
	TrackEditView& trackView;
};

class TrackEditView::InsertStrumCommand: public QUndoCommand {
public:
	InsertStrumCommand(TrackEditView& tv, TabTrack& trk, TrackPos& pos, std::vector<int> &_chord);
	virtual ~InsertStrumCommand();
	
	virtual void execute();
	virtual void unexecute();
	
private:
	TrackPos& currentPos;
	const TrackPos oldPos;
	const std::vector<int> chord;
	const TabTimes oldTimes;
	TrackEditView& trackView;
	TabTrack& tabTrack;
};

class QListBox;

class TrackEditView::InsertRhythm: public QUndoCommand {
public:
	InsertRhythm(TrackEditView& tv, TabTrack& trk, QListBox& quantized, TrackPos& pos);
	virtual ~InsertRhythm();
	
	virtual void execute();
	virtual void unexecute();
	
private:
	TrackPos& currentPos;
	const TrackPos oldPos;
	std::vector<Duration> newdur;
	TabTrack& tabTrack;
	TrackEditView& trackView;
	TabBar oldBar;
};

class TrackEditView::NTupletCommand: public QUndoCommand {
public:
	NTupletCommand(TrackEditView &_tv, TabTrack &_trk, TrackPos& pos, uint n);
	virtual ~NTupletCommand();
	
	virtual void execute();
	virtual void unexecute();
private:
	TrackPos& currentPos;
	const TrackPos oldPos;
	TrackEditView &tv;
	TabTrack &tabTrack;
	TabTimes oldTime;
	uint ntuplet;
};
*/
#endif
