/***************************************************************************
 * tabtime.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 TABTIMES_H
#define TABTIMES_H

#include <QList>
#include <QString>

#include "tabduration.h"
#include "tabbeateffects.h"
#include "tabchord.h"

class TabNote;

class TabTime
{
public:
	TabTime(uchar time);
	virtual ~TabTime();
	
	virtual void clone(const TabTime* time);
	
	virtual uchar time() const;
	
	virtual void setString(uchar stringNumber, TabNote* note);
	virtual TabNote* string(uchar stringNumber) const;
	virtual void deleteString(uchar stringNumber);
	
	virtual bool isNoteExist(uchar stringNumber) const;
	
	virtual void setFret(uchar stringNumber, uint fret);
	virtual uchar fret(uchar stringNumber) const;
	virtual void deleteFret(uchar stringNumber);
	
	virtual void setDuration(Duration i);
	virtual Duration duration() const;
	virtual double realDuration() const;
	
	virtual void setRest(bool i);
	virtual bool isRest() const;
	
	virtual bool isNoteEmpty(uchar stringNumber) const;
	
	virtual void setDeadNote(uchar stringNumber, bool b);
	virtual bool isDeadNote(uchar stringNumber) const;
	
	virtual bool isNoteGhostNote(uchar stringNumber) const;
	
	virtual void setDotted(bool i);
	virtual bool isDotted() const;
	
	virtual void setNTuplet(uint i);
	virtual uint nTuplet() const;
	
	virtual void setText(const QString& s);
	virtual QString text() const;
	
	virtual void setChord(bool b);
	virtual bool isChord() const;
	
	virtual bool isEmpty() const;
	virtual unsigned int size() const;
	
	virtual void setEffect(TabTimeEffect* effect);
	virtual TabTimeEffect* effect() const;
	virtual bool hasEffect() const;
	
	virtual void setRasgueado(bool b);
	virtual bool isRasgueado() const;
	
	virtual bool hasPickStroke() const;
	virtual void setPickStroke(PickStroke p);
	virtual PickStroke pickstroke() const;
	
	virtual bool hasTremolo() const;
	virtual void setTremolo(int i);
	virtual int tremolo() const;
	
	virtual void setTapping(bool b);
	virtual bool isTapping() const;
	
	virtual void setPopping(bool b);
	virtual bool isPopping() const;
	
	virtual void setSlapping(bool b);
	virtual bool isSlapping() const;
	
	virtual void setStroke(bool b);
	virtual bool isStroke() const;
	
	virtual void setUpStroke(int i);
	virtual int upStroke() const;
	
	virtual void setDownStroke(int i);
	virtual int downStroke() const;
	
	virtual void setVibrato(bool b);
	virtual bool isVibrato() const;
	
	virtual void setWideVibrato(bool b);
	virtual bool isWideVibrato() const;
	
	virtual void setNaturalHarmonic(bool b);
	virtual bool isNaturalHarmonic() const;
	
	virtual void setArtificialHarmonic(bool b);
	virtual bool isArtificialHarmonic() const;
	
	virtual void setFadeIn(bool b);
	virtual bool isFadeIn() const;
	
	virtual void setBend(TabBend* bend);
	virtual TabBend* bend() const;
	
	virtual void setBendType(TabBend::BendType b);
	virtual TabBend::BendType bendType() const;
	
	virtual void setBendValue(int i);
	virtual int bendValue() const;
	virtual QString bendValueToString() const;
	
	virtual int sizeOfBendPoints() const;
	virtual void addBendPoint(TabBendPoint* point);
	virtual void setBendPoint(uint i, TabBendPoint* point);
	virtual void removeBendPoint(uint i);
	virtual TabBendPoint* bendPoint(uint i) const;
	
	virtual void setTabChord(TabChord* tabChord);
	virtual TabChord* tabChord() const;
	virtual bool hasChord() const;
	
	virtual void setName(const QString& s);
	virtual QString name() const;
	
	virtual void setSharp(bool b);
	virtual bool isSharp() const;
	
	virtual void setRoot(uchar c);
	virtual uchar root() const;
	
	virtual void setType(uchar c);
	virtual uchar type() const;
	
	virtual void setNineElevenThirteen(TabChord::ExtentionChord c);
	virtual TabChord::ExtentionChord nineElevenThirteen() const;
	
	virtual void setBass(uchar c);
	virtual uchar bass() const;
	
	virtual void setAugmentedDiminished(TabChord::AugmentedDiminished a);
	virtual TabChord::AugmentedDiminished augmentedDiminished() const;
	
	virtual void setAddedNote(uchar c);
	virtual uchar addedNote() const;
	
	virtual void setTonalityFive(uchar c);
	virtual uchar tonalityFive() const;
	
	virtual void setTonalityNine(uchar c);
	virtual uchar tonalityNine() const;
	
	virtual void setTonalityEleven(uchar c);
	virtual uchar tonalityEleven() const;
	
	virtual void setBaseFret(long l);
	virtual long baseFret() const;
	
	virtual void setFretChord(uchar c, long l);
	virtual long fretChord(uchar c) const;
	
	virtual void setNumBarres(uchar c);
	virtual uchar numBarres() const;
	
	virtual void setBarreFret(uchar c, uchar d);
	virtual uchar barreFret(uchar c) const;
	
	virtual void setBarreStart(uchar c, uchar d);
	virtual uchar barreStart(uchar c) const;
	
	virtual void setBarreEnd(uchar c, uchar d);
	virtual uchar barreEnd(uchar c) const;
	
	virtual void setFingering(uchar c, uchar d);
	virtual uchar fingering(uchar c) const;
	
	virtual void setShowDiagram(bool b);
	virtual bool isShowDiagram() const;
	
	virtual bool isAccentuated(uint stringNumber) const;
	
	virtual void setGhostNote(uint stringNumber, bool b);
	virtual bool isGhostNote(uint stringNumber) const;
	
	virtual void setTieNote(uint stringNumber, bool b);
	virtual bool isTieNote(uint stringNumber) const;
	
	virtual void setHammerOnPullOff(uint stringNumber, bool b);
	virtual bool isHammerOnPullOff(uint stringNumber) const;
	
	virtual void setLetRing(uint stringNumber, bool b);
	virtual bool isLetRing(uint stringNumber) const;
	
	virtual bool isDynamic(uint stringNumber) const;
	virtual bool isFingeringLeft(uint stringNumber) const;
	virtual bool isFingeringRight(uint stringNumber) const;
	virtual bool isPalmMute(uint stringNumber) const;
	virtual bool isStaccato(uint stringNumber) const;
	virtual bool isTremoloPicking(uint stringNumber) const;
	virtual bool isHarmonic(uint stringNumber) const;
	virtual bool isGraceNote(uint stringNumber) const;
	virtual TabBend* bend(uint stringNumber) const;
	virtual void setBend(uint stringNumber, TabBend* bend) const;
	virtual bool isBend(uint stringNumber) const;
	virtual bool isTrill(uint stringNumber) const;
	
	virtual bool operator==(const TabTime& time) const;
	virtual bool operator!=(const TabTime& time) const;
	
private:
	typedef QMap<unsigned char, TabNote*>::iterator iterator;
	typedef QMap<unsigned char, TabNote*>::const_iterator const_iterator;
	
	uchar mTime;
	Duration mDuration;
	bool mDotted;
	bool mRest;
	unsigned int mTuplet;
	mutable QMap<unsigned char, TabNote*> mChordFretted;
	QString mComment;
	bool mChord;
	
	TabTimeEffect* mEffect;
	TabChord* mTabChord;
};

#endif
