MuseScore/libmscore/iname.cpp

65 lines
1.9 KiB
C++
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#include "score.h"
#include "iname.h"
2013-05-13 18:49:17 +02:00
namespace Ms {
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
// InstrumentName
//---------------------------------------------------------
InstrumentName::InstrumentName(Score* s)
: Text(s)
{
setInstrumentNameType(InstrumentNameType::SHORT);
2012-05-26 14:26:10 +02:00
_layoutPos = 0;
}
//---------------------------------------------------------
// instrumentNameTypeName
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
QString InstrumentName::instrumentNameTypeName() const
2012-05-26 14:26:10 +02:00
{
if (instrumentNameType() == InstrumentNameType::SHORT)
2012-05-26 14:26:10 +02:00
return QString("short");
return QString("long");
}
//---------------------------------------------------------
// setInstrumentNameType
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
void InstrumentName::setInstrumentNameType(const QString& s)
2012-05-26 14:26:10 +02:00
{
if (s == "short")
setInstrumentNameType(InstrumentNameType::SHORT);
2012-05-26 14:26:10 +02:00
if (s == "long")
setInstrumentNameType(InstrumentNameType::LONG);
2012-05-26 14:26:10 +02:00
else
qDebug("InstrumentName::setSubtype: unknown <%s>", qPrintable(s));
}
void InstrumentName::setInstrumentNameType(InstrumentNameType st)
{
_instrumentNameType = st;
if (st == InstrumentNameType::SHORT)
setTextStyleType(TextStyleType::INSTRUMENT_SHORT);
else
setTextStyleType(TextStyleType::INSTRUMENT_LONG);
}
2012-05-26 14:26:10 +02:00
2013-05-13 18:49:17 +02:00
}