/* ============================================================
 * File  : tetrahedron.cpp
 * Author: Stephane Gibault
 * Date  : Sun Feb 4 2007
 * Description :
 *
 * 
 *  (C) 2007 by Stephane Gibault
 *
 * 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, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */
#include <QtGui>
#include "audio_editor.h"

audio_editor::audio_editor ( QWidget * parent )
    : QLabel(parent)
{
	this->setMouseTracking(true);
	this->setScaledContents(true);
	this->setAutoFillBackground(true);
	position = 0;
	fin = 0;
	current = 0;
}

void audio_editor::mouseMoveEvent(QMouseEvent *event)
{
	if (!(event->buttons() & Qt::LeftButton)) return;
	if (event->globalPos().x() - dragPosition.x() < 10) return;
	position = (event->globalPos().x() - dragPosition.x())/107;
	if ( position > nbre_diapo ) return;
	move((position*107)+10,80);
	emit recalc();
}

void audio_editor::mousePressEvent ( QMouseEvent * event ) 
{
	dragPosition = event->globalPos() - frameGeometry().topLeft();
}

