/***************************************************************************
 * tabchord.h: implementation of TabChord
 *
 * This file is part of KGuitar, a KDE tabulature editor
 *
 * copyright (C) 2003-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.
 ***************************************************************************/
 
#include "tabchord.h"
#include "util/assert.h"

TabChord::TabChord()
: mName(),
  mSharp(false),
  mRoot(0),
  mType(0),
  mExtention(noneExtention),
  mBass(0),
  mAugmentedDiminished(noneAugmentedDiminished),
  mAddedNote(0),
  mBaseFret(0),
  mFive(0),
  mNine(0),
  mEleven(0),
  mBase(0),
  mFret(),
  mBarres(0),
  mBarreFret(),
  mBarreStart(), 
  mBarreEnd(),
  mFingering(),
  mShow(false)
{
}

TabChord::~TabChord()
{
}

void TabChord::clone(const TabChord* chord)
{
	PRECONDITION( chord != 0x0 );
	
	mSharp = chord->mSharp;
	mRoot = chord->mRoot;
	mType = chord->mType;
	mExtention = chord->mExtention;
	mBass = chord->mBass;
	mAugmentedDiminished = chord->mAugmentedDiminished;
	mAddedNote = chord->mAddedNote;
	mBaseFret = chord->mBaseFret;
	mFive = chord->mFive;
	mNine = chord->mNine;
	mEleven = chord->mEleven;
	mBase = chord->mBase;
	mFret = chord->mFret;
	mBarres = chord->mBarres;
	mBarreFret = chord->mBarreFret;
	mBarreStart = chord->mBarreStart; 
	mBarreEnd = chord->mBarreEnd;
	mFingering = chord->mFingering;
	mShow = chord->mShow;
}

void TabChord::setName(const QString& s)
{
	mName = s;
	
	emit chordChanged();
}

QString TabChord::name() const
{
	return mName;
}

void TabChord::setSharp(bool b)
{
	mSharp = b;
	
	emit chordChanged();
}

bool TabChord::isSharp() const
{
	return mSharp;
}

void TabChord::setRoot(uchar c)
{
	mRoot = c;
	
	emit chordChanged();
}

uchar TabChord::root() const
{
	return mRoot;
}

void TabChord::setType(uchar c)
{
	mType = c;
	
	emit chordChanged();
}

uchar TabChord::type() const
{
	return mType;
}

void TabChord::setNineElevenThirteen(ExtentionChord c)
{
	mExtention = c;
	
	emit chordChanged();
}

TabChord::ExtentionChord TabChord::nineElevenThirteen() const
{
	return mExtention;
}

void TabChord::setBass(uchar c)
{
	mBass = c;
	
	emit chordChanged();
}

uchar TabChord::bass() const
{
	return mBass;
}

void TabChord::setAugmentedDiminished(AugmentedDiminished a)
{
	mAugmentedDiminished = a;
	
	emit chordChanged();
}

TabChord::AugmentedDiminished TabChord::augmentedDiminished() const
{
	return mAugmentedDiminished;
}

void TabChord::setAddedNote(uchar c)
{
	mAddedNote = c;
	
	emit chordChanged();
}

uchar TabChord::addedNote() const
{
	return mAddedNote;
}

void TabChord::setTonalityFive(uchar c)
{
	mFive = c;
	
	emit chordChanged();
}

uchar TabChord::tonalityFive() const
{
	return mFive;
}

void TabChord::setTonalityNine(uchar c)
{
	mNine = c;
	
	emit chordChanged();
}

uchar TabChord::tonalityNine() const
{
	return mNine;
}

void TabChord::setTonalityEleven(uchar c)
{
	mEleven = c;
	
	emit chordChanged();
}

uchar TabChord::tonalityEleven() const
{
	return mEleven;
}

void TabChord::setBaseFret(long l)
{
	mBaseFret = l;
	
	emit chordChanged();
}

long TabChord::baseFret() const
{
	return mBaseFret;
}

void TabChord::setFret(uchar c, long l)
{
	mFret[c] = l;
	
	emit chordChanged();
}

long TabChord::fret(uchar c) const
{
	return mFret[c];
}

void TabChord::setNumBarres(uchar c)
{
	mBarres = c;
	
	emit chordChanged();
}

uchar TabChord::numBarres() const
{
	return mBarres;
}

void TabChord::setBarreFret(uchar c, uchar d)
{
	mBarreFret[c] = d;
	
	emit chordChanged();
}

uchar TabChord::barreFret(uchar c) const
{
	return mBarreFret[c];
}

void TabChord::setBarreStart(uchar c, uchar d)
{
	mBarreStart[c] = d;
	
	emit chordChanged();
}

uchar TabChord::barreStart(uchar c) const
{
	return mBarreStart[c];
}

void TabChord::setBarreEnd(uchar c, uchar d)
{
	mBarreEnd[c] = d;
	
	emit chordChanged();
}

uchar TabChord::barreEnd(uchar c) const
{
	return mBarreEnd[c];
}

void TabChord::setFingering(uchar c, uchar d)
{
	mFingering[c] = d;
	
	emit chordChanged();
}

uchar TabChord::fingering(uchar c) const
{
	return mFingering[c];
}

void TabChord::setShowDiagram(bool b)
{
	mShow = b;
	
	emit chordChanged();
}

bool TabChord::isShowDiagram() const
{
	return mShow;
}

bool TabChord::operator==(const TabChord& chord) const
{
	return (mName == chord.mName && mSharp == chord.mSharp &&
			mRoot == chord.mRoot && mType == chord.mType &&
			mExtention == chord.mExtention && mBass == chord.mBass &&
			mAugmentedDiminished == chord.mAugmentedDiminished && mAddedNote == chord.mAddedNote &&
			mBaseFret == chord.mBaseFret && mFive == chord.mFive &&
			mNine == chord.mNine && mEleven == chord.mEleven &&
			mBase == chord.mBase && mFret == chord.mFret &&
			mBarres == chord.mBarres && mBarreFret == chord.mBarreFret &&
			mBarreStart == chord.mBarreStart && mBarreEnd == chord.mBarreEnd &&
			mFingering == chord.mFingering && mShow == chord.mShow);
}

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

#include "tabchord.moc"
