/***************************************************************************
 * tabbar.h: implementation of TabBar class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2007 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 TABBAR_H
#define TABBAR_H

#include <QList>

#include "tabduration.h"
#include "tabmixtablechanges.h"
#include "tabbarproperties.h"

class TabBend;
class TabNote;
class TabTime;

class TabBar
{
public:
	TabBar(uchar bar);
	TabBar(uchar bar, uchar i, uchar j);
	virtual ~TabBar();
	
	virtual void clone(const TabBar* bar);
	
	virtual uchar bar() const;
	
	virtual void setKeySignature(uint i);
	virtual uint keySignature() const;
	
	virtual uint size() const;
	
	virtual void insertTime(TabTime* time);
	virtual void setTime(int timeNumber, TabTime* time);
	virtual TabTime* time(int timeNumber) const;
	virtual void deleteTime(int timeNumber);
	virtual void setTimeDuration(int timeNumber, Duration duration);
	virtual Duration timeDuration(int timeNumber) const;
	virtual double timeRealDuration(int timeNumber) const;
	virtual bool isEmptyTime(int timeNumber) const;
	virtual void setRest(int timeNumber, bool b);
	virtual bool isDotted(int timeNumber) const;
	virtual void setDotted(int timeNumber, bool b);
	
	virtual void setNote(int timeNumbers, uint stringNumber, TabNote* tabNote);
	virtual TabNote* note(int timeNumbers, uint stringNumber) const;
	virtual void deleteNote(int timeNumbers, uint stringNumber);
	
	virtual void setFret(int timeNumbers, uint stringNumber, uint fret);
	virtual char fret(int timeNumber, uint stringNumber) const;
	virtual void deleteFret(int timeNumber, uint stringNumber);
	
	virtual bool isRestTime(int timeNumber) const;
	virtual bool isEmptyNote(int timeNumber, uint stringNumber) const;
	virtual bool isTieNote(int timeNumber, uint stringNumber) const;
	virtual bool isFull() const;
	virtual bool isOverTaken() const;
	
	virtual void setMixer(TabMixTableChanges* mixer);
	virtual TabMixTableChanges* mixer() const;
	virtual bool hasMixer() const;
	
	virtual void setInstrument(int i);
	virtual int instrument() const;
	
	virtual void setVolume(int i);
	virtual int volume() const;
	
	virtual void setBalance(int i);
	virtual int balance() const;
	
	virtual void setChorus(int i);
	virtual int chorus() const;
	
	virtual void setReverb(int i);
	virtual int reverb() const;
	
	virtual void setPhaser(int i);
	virtual int phaser() const;
	
	virtual void setTremolo(int i);
	virtual int tremolo() const;
	
	virtual void setTempo(int i);
	virtual int tempo() const;
	
	virtual void setProperties(TabBarProperties* properties);
	virtual TabBarProperties* properties() const;
	virtual bool hasProperties() const;
	
	virtual void setColor(const QColor& i);
	virtual QColor color() const;
	
	virtual void setMarker(const QString& s);
	virtual QString marker() const;
	
	virtual void setRepeatBar(bool b);
	virtual bool isRepeatBar() const;
	
	virtual void setCloseBar(bool b, QChar v);
	virtual bool isCloseBar() const;
	
	virtual void setAltBar(bool b);
	virtual bool isAltBar() const;
	
	virtual void setRepeatStart(bool b);
	virtual bool isRepeatStart() const;
	
	virtual void setRepetitions(int i);
	virtual int repetitions() const;
	
	virtual void setAlternateEndings(int i);
	virtual int isAlternateEndings() const;
	
	virtual void setDoubleBar(bool b);
	virtual bool isDoubleBar() const;
	
	virtual void setSongKey(SongKey* key);
	virtual SongKey* songKey() const;
	
	virtual void setKey(QChar c);
	virtual QChar key() const;
	virtual char asciiCodeOfKey() const;
	virtual QString nameOfKey() const;
	
	virtual void setMinor(bool i);
	virtual bool isMinor() const;
	
	virtual void setTimeSignature(TimeSignature* timeSignature);
	virtual TimeSignature* timeSignature() 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(uint timeNumber, uint stringNumber, bool b);
	virtual bool isDeadNote(uint timeNumber, uint stringNumber) const;
	virtual bool isAccentuated(uint timeNumber, uint stringNumber) const;
	
	virtual void setGhostNote(uint timeNumber, uint stringNumber, bool b);
	virtual bool isGhostNote(uint timeNumber, uint stringNumber) const;
	
	virtual void setTieNote(uint timeNumber, uint stringNumber, bool b);
	virtual bool isTieNote(uint timeNumber, uint stringNumber) const;
	
	virtual void setHammerOnPullOff(uint timeNumber, uint stringNumber, bool b);
	virtual bool isHammerOnPullOff(uint timeNumber, uint stringNumber) const;
	
	virtual void setLetRing(uint timeNumber, uint stringNumber, bool b);
	virtual bool isLetRing(uint timeNumber, uint stringNumber) const;
	
	virtual bool isDynamic(uint timeNumber, uint stringNumber) const;
	virtual bool isFingeringLeft(uint timeNumber, uint stringNumber) const;
	virtual bool isFingeringRight(uint timeNumber, uint stringNumber) const;
	virtual bool isPalmMute(uint timeNumber, uint stringNumber) const;
	virtual bool isStaccato(uint timeNumber, uint stringNumber) const;
	virtual bool isTremoloPicking(uint timeNumber, uint stringNumber) const;
	virtual bool isHarmonic(uint timeNumber, uint stringNumber) const;
	virtual bool isGraceNote(uint timeNumber, uint stringNumber) const;
	
	virtual TabBend* bend(uint timeNumber, uint stringNumber) const;
	virtual void setBend(uint timeNumber, uint stringNumber, TabBend* bend) const;
	virtual bool isBend(uint timeNumber, uint stringNumber) const;
	
	virtual bool isTrill(uint timeNumber, uint stringNumber) const;
	
	virtual bool isRasgueado(uint timeNumber) const;
	virtual bool isPickStroke(uint timeNumber) const;
	virtual bool isTremolo(uint timeNumber) const;
	virtual bool isTapping(uint timeNumber) const;
	virtual bool isPopping(uint timeNumber) const;
	virtual bool isSlapping(uint timeNumber) const;
	virtual bool isStroke(uint timeNumber) const;
	virtual bool isVibrato(uint timeNumber) const;
	virtual bool isFadeIn(uint timeNumber) const;
	
	virtual bool operator==(const TabBar& tabBar) const;
	virtual bool operator!=(const TabBar& tabBar) const;
	
private:
	typedef QList<TabTime*>::iterator iterator;
	typedef QList<TabTime*>::const_iterator const_iterator;
	
	uint mBar;
	uint keysig;
	QList<TabTime*> mTabTime;
	TabMixTableChanges* mMixer;
	TabBarProperties* mProperties;
};

#endif
