/***************************************************************************
 * qpointcm.h: implementation of QPointCm 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.
 ***************************************************************************/

#include "qpointcm.h"

QPointCm::QPointCm()
: mX(0, 75),
  mY(0, 75)
{
}

QPointCm::QPointCm(const Cm& x, const Cm& y)
: mX(x),
  mY(y)
{
}

QPointCm::~QPointCm()
{
}

void QPointCm::setX(const Cm& x)
{
	mX = x;
}

Cm QPointCm::x() const
{
	return mX;
}

void QPointCm::setY(const Cm& y)
{
	mY = y;
}

Cm QPointCm::y() const
{
	return mY;
}

QPointF QPointCm::toQPointF() const
{
	return QPointF(mX.valueOfPixel(), mY.valueOfPixel());
}

QPointCm QPointCm::operator+ (const QPointCm& point) const
{
	return QPointCm(mX + point.mX, mY + point.mY);
}

QPointCm QPointCm::operator- (const QPointCm& point) const
{
	return QPointCm(mX - point.mX, mY - point.mY);
}

QPointCm QPointCm::operator+= (const QPointCm& point)
{
	mX+=point.mX;
	mY+=point.mY;
	
	return *this;
}

QPointCm QPointCm::operator-= (const QPointCm& point)
{
	mX-=point.mX;
	mY-=point.mY;
	
	return *this;
}

bool QPointCm::operator==(const QPointCm& point) const
{
	return (mX == point.mX && mY == point.mY);
}

bool QPointCm::operator!=(const QPointCm& point) const
{
	return !this->operator==(point);
}
