/***************************************************************************
 * tracktimeview.h: implementation of TrackTimeView class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2006-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 TRACKTIMESVIEW_H
#define TRACKTIMESVIEW_H

#include <QFont>
#include <QMap>

#include "drawingitem.h"

class TabNote;
class TabTime;

class TrackTimesView : public DrawingItem
{
public:
	TrackTimesView(const TabTime* times, const QFont& textFont, uint strings, const Cm& space, uint dpi);
	virtual ~TrackTimesView();
	
	virtual void hide();
	virtual void show();
	
	virtual void drawFret();
	virtual void drawNote(uint note, const TabNote* tnote);
	
	virtual void refreshTime(const TabTime* tabTime);
	virtual void refreshNoteAt(int note, const TabNote* tabNote);
	
	virtual bool isPointInTime(const QPointCm& point) const;
	
	virtual QRectCm boundingRect () const;
	virtual Cm height() const;
	virtual Cm width() const;
	
	virtual uint cursorPositionAt(const QPointCm& point);
private:
	typedef QMap<uchar , QGraphicsItem*>::iterator iterator;
	typedef QMap<uchar , QGraphicsItem*>::const_iterator const_iterator;
	
	const static QFont sClassicalFont;
	
	const TabTime* mTabTime;
	const QFont mFont;
	const uint mNbStrings;
	const Cm mLineSpaces;
	const Cm mTimeSpace;
	
	QMap<uchar , QGraphicsItem*> mNoteCollection;
	QMap<uchar , QGraphicsItem*> mEffectCollection;
	QGraphicsItem* mDottedTime;
	QGraphicsItem* mRestTime;
};

#endif
