/***************************************************************************
 * tabtrack.h
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2006- 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 TABTRACK_H
#define TABTRACK_H

#include <QList>

#include "tabduration.h"
#include "trackproperties.h"

class TabBend;
class TabNote;
class TabTime;
class TabBar;
class TrackPos;

class TabTrack
{
public:
	TabTrack();
	TabTrack(TrackMode tm, const QString& name, int channel, int bank, uchar patch, char string, char frets);
	virtual ~TabTrack();
	
	virtual void clone(const TabTrack* track);
	
	virtual void addBar(TabBar* bar);
	virtual void insertBar(int barNumber, TabBar* bar);
	virtual void insertEmptyBar(const TrackPos& position);
	virtual void insertEmptyBar(int barNumber);
	virtual TabBar* bar(int barNumber) const;
	virtual void setBar(int barNumber, TabBar* bar);
	virtual void deleteBar(int barNumber);
	virtual uint barSize(int barNumber) const;
	virtual uint numeratorOfBar(int barNumber) const;
	virtual uint denominatorOfBar(int barNumber) const;
	virtual bool areTimesSignaturesEquals(int barNumber1, int barNumber2) const;
	
	virtual void setTime(const TrackPos& position, TabTime* tabTime);
	virtual void setTime(int barNumber, uint timeNumber, TabTime* tabTime);
	virtual void insertTime(const TrackPos& position, TabTime* tabTime);
	virtual void insertTime(int barNumber, TabTime* tabTime);
	virtual void deleteTime(int barNumber, uint timeNumber);
	virtual void deleteTime(const TrackPos& position);
	virtual TabTime* time(const TrackPos& position) const;
	virtual TabTime* time(int barNumber, uint timeNumber) const;
	virtual void setTimeDuration(const TrackPos& position, Duration duration);
	virtual void setTimeDuration(int barNumber, uint timeNumber, Duration duration);
	virtual Duration timeDuration(const TrackPos& position) const;
	virtual Duration timeDuration(int barNumber, uint timeNumber) const;
	virtual bool isEmptyTime(const TrackPos& position) const;
	virtual bool isEmptyTime(int barNumber, uint timeNumber) const;
	virtual void setRest(int barNumber, uint timeNumber, bool b);
	virtual void setRest(const TrackPos& position, bool b);
	virtual void setDotted(int barNumber, uint timeNumber, bool b);
	virtual void setDotted(const TrackPos& position, bool b);
	
	virtual void setNote(const TrackPos& position, TabNote* tabNote);
	virtual void setNote(int barNumber, uint timeNumber, uint stringNumber, TabNote* tabNote);
	virtual TabNote* note(const TrackPos& position) const;
	virtual TabNote* note(int barNumber, uint timeNumber, uint stringNumber) const;
	virtual void deleteNote(int barNumber, uint timeNumber, uint stringNumber);
	virtual void deleteNote(const TrackPos& position);
	
	virtual void setFret(const TrackPos& position, uint fret);
	virtual void setFret(int barNumber, uint timeNumber, uint stringNumber, uint fret);
	virtual char fret(const TrackPos& position) const;
	virtual char fret(int barNumber, uint time, uint stringNumber) const;
	virtual void deleteFret(int barNumber, uint time, uint stringNumber);
	virtual void deleteFret(const TrackPos& position);
	
	virtual unsigned int size() const { return mTabBar.size(); };
	
	virtual bool isEmptyNote(int barNumber, uint time, uint string) const;
	virtual bool isEmptyNote(const TrackPos& position) const;
	virtual bool isTieNote(int barNumber, uint time, uint string) const;
	virtual bool isRest(int bar, uint time) const;
	virtual bool isRest(const TrackPos& position) const;
	virtual bool isDotted(int bar, uint time) const;
	virtual bool isDotted(const TrackPos& position) const;
	virtual bool isLastBar(uint barNumber) const;
	
	virtual void setProperties(TrackProperties* properties);
	virtual TrackProperties* properties() const;
	virtual bool hasProperties() const;
	
	virtual void setMode(TrackMode mode);
	virtual TrackMode mode() const;
	
	virtual void setName(const QString &string);
	virtual QString name() const;
	
	virtual void setColor(const QColor& c);
	virtual QColor color() const;
	
	virtual void setNbStrings(uchar i);
	virtual uchar nbStrings() const;
	
	virtual void setNbFrets(uchar i);
	virtual uchar nbFrets() const;
	
	virtual void setTune(uchar i, uchar j);
	virtual uchar tune(uchar i) const;
	
	virtual void setCapo(uchar c);
	virtual uchar capo() const;
	
	virtual void setMidiProperties(TrackMidiProperties* midiProperties);
	virtual TrackMidiProperties* midiProperties() const;
	virtual bool hasMidiProperties() const;
	
	virtual void setPatch(uchar i);
	virtual uchar patch() const;
	
	virtual void setChannel(uchar i);
	virtual uchar channel() const;
	
	virtual void setChannelEffects(uchar i);
	virtual uchar channelEffects() const;
	
	virtual void setMidiPort(int i);
	virtual int midiPort() const;
	
	virtual void setBank(unsigned int i);
	virtual unsigned int bank() const;
	
	virtual void setVolume(uchar i);
	virtual uchar volume() const;
	
	virtual void setBalance(char i);
	virtual char balance() const;
	
	virtual void setChorus(uchar i);
	virtual uchar chorus() const;
	
	virtual void setReverb(uchar i);
	virtual uchar reverb() const;
	
	virtual void setPhaser(uchar i);
	virtual uchar phaser() const;
	
	virtual void setTremolo(uchar i);
	virtual uchar tremolo() const;
	
	virtual void setTimeSignature(TimeSignature* timeSignature);
	virtual TimeSignature* timeSignature() const;
	virtual bool hasTimeSignature() const;
	
	virtual void setNumerator(uchar c);
	virtual uchar numerator() const;
	
	virtual void setDenominator(uchar c);
	virtual uchar denominator() const;
	
	virtual uint timeLigatures() const;
	
	virtual void setDeadNote(const TrackPos& position, bool b);
	virtual bool isDeadNote(const TrackPos& position) const;
	virtual bool isAccentuated(const TrackPos& position) const;
	
	virtual void setGhostNote(const TrackPos& position, bool b);
	virtual bool isGhostNote(const TrackPos& position) const;
	
	virtual void setTieNote(const TrackPos& position, bool b);
	virtual bool isTieNote(const TrackPos& position) const;
	
	virtual void setHammerOnPullOff(const TrackPos& position, bool b);
	virtual bool isHammerOnPullOff(const TrackPos& position) const;
	
	virtual void setLetRing(const TrackPos& position, bool b);
	virtual bool isLetRing(const TrackPos& position) const;
	
	virtual bool isDynamic(const TrackPos& position) const;
	virtual bool isFingeringLeft(const TrackPos& position) const;
	virtual bool isFingeringRight(const TrackPos& position) const;
	virtual bool isPalmMute(const TrackPos& position) const;
	virtual bool isStaccato(const TrackPos& position) const;
	virtual bool isTremoloPicking(const TrackPos& position) const;
	virtual bool isHarmonic(const TrackPos& position) const;
	virtual bool isGraceNote(const TrackPos& position) const;
	
	virtual TabBend* bend(const TrackPos& position) const;
	virtual void setBend(const TrackPos& position, TabBend* bend) const;
	virtual bool isBend(const TrackPos& position) const;
	
	virtual bool isTrill(const TrackPos& position) const;
	
	virtual bool isRasgueado(const TrackPos& position) const;
	virtual bool hasPickStroke(const TrackPos& position) const;
	virtual bool hasTremolo(const TrackPos& position) const;
	virtual bool isTapping(const TrackPos& position) const;
	virtual bool isPopping(const TrackPos& position) const;
	virtual bool isSlapping(const TrackPos& position) const;
	virtual bool isStroke(const TrackPos& position) const;
	virtual bool isVibrato(const TrackPos& position) const;
	virtual bool isFadeIn(const TrackPos& position) const;
	
	virtual bool operator==(const TabTrack& tabTrack) const;
	virtual bool operator!=(const TabTrack& tabTrack) const;
	
private:
	typedef QList<TabBar*>::iterator iterator;
	typedef QList<TabBar*>::const_iterator const_iterator;
	
	QList<TabBar*> mTabBar;
	TrackProperties* mProperties;
};

#endif
