Skip to content

Commit

Permalink
cleanups for text; simplify SyntiParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 14, 2013
1 parent f1d735f commit f41fbba
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 366 deletions.
2 changes: 1 addition & 1 deletion aeolus/aeolus/addsynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void N_func::clrv (int i)
if ((j >= 0) && (k <= M)) {
d = (_v [k] - _v [j]) / (k - j);
for (i = j + 1; i < k; i++)
_v [i] = _v [i] = _v [j] + (i - j) * d;
_v [i] = _v [j] + (i - j) * d;
}
else if (j >= 0) {
d = _v [j];
Expand Down
2 changes: 1 addition & 1 deletion libmscore/exportmidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ void ExportMidi::writeHeader()
if (mf.tracks()->isEmpty())
return;
MidiTrack* track = mf.tracks()->front();
#if 0 // TODO
MeasureBase* measure = cs->first();

#if 0 // TODO
foreach (const Element* e, *measure->el()) {
if (e->type() == Element::TEXT) {
const Text* text = (const Text*)(e);
Expand Down
2 changes: 0 additions & 2 deletions libmscore/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ void Page::draw(QPainter* painter) const
{
if (score()->layoutMode() != LayoutPage)
return;
extern QReadWriteLock docRenderLock;
QWriteLocker locker(&docRenderLock);
//
// draw header/footer
//
Expand Down
9 changes: 0 additions & 9 deletions libmscore/simpletext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,15 +562,6 @@ void SimpleText::moveCursor(int col)
printf("moveCursor\n");
}

//---------------------------------------------------------
// addSymbol
//---------------------------------------------------------

void SimpleText::addSymbol(const SymCode&)
{
printf("add symbol\n");
}

//---------------------------------------------------------
// addChar
//---------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion libmscore/simpletext.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class SimpleText : public Element {
bool edit(MuseScoreView*, int, int key, Qt::KeyboardModifiers, const QString&);
void moveCursorToEnd();
void moveCursor(int col);
void addSymbol(const SymCode&);
void addChar(int code);
bool deletePreviousChar();
bool deleteChar();
Expand Down
225 changes: 24 additions & 201 deletions libmscore/sparm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,52 @@
//=============================================================================

#include "libmscore/xml.h"
#include "sparm_p.h"
#include "sparm.h"

//---------------------------------------------------------
// SyntiParameterData
// SyntiParameter
//---------------------------------------------------------

SyntiParameterData::SyntiParameterData()
SyntiParameter::SyntiParameter()
{
_id = -1;
_type = SP_FLOAT;
_fval = 0.0;
}

SyntiParameterData::SyntiParameterData(const QString& name, float val)
SyntiParameter::SyntiParameter(const QString& name, float val)
{
_id = -1;
_name = name;
_type = SP_FLOAT;
_fval = val;
}

SyntiParameterData::SyntiParameterData(int i, const QString& name, float val)
SyntiParameter::SyntiParameter(int i, const QString& name, float val)
{
_id = i;
_name = name;
_type = SP_FLOAT;
_fval = val;
}

SyntiParameterData::SyntiParameterData(const QString& name, const QString& val)
SyntiParameter::SyntiParameter(const QString& name, const QString& val)
{
_id = -1;
_name = name;
_type = SP_STRING;
_sval = val;
}

SyntiParameterData::SyntiParameterData(int i, const QString& name, const QString& val)
SyntiParameter::SyntiParameter(int i, const QString& name, const QString& val)
{
_id = i;
_name = name;
_type = SP_STRING;
_sval = val;
}

SyntiParameterData::SyntiParameterData(const SyntiParameterData& pd)
: QSharedData(pd)
SyntiParameter::SyntiParameter(const SyntiParameter& pd)
{
_id = pd._id;
_name = pd._name;
Expand All @@ -82,15 +81,9 @@ SyntiParameterData::SyntiParameterData(const SyntiParameterData& pd)
}
}

SyntiParameter& SyntiParameter::operator=(const SyntiParameter& sp)
{
d = sp.d;
return *this;
}

bool SyntiParameterData::operator==(const SyntiParameterData& sp) const
bool SyntiParameter::operator==(const SyntiParameter& sp) const
{
if (_id == -1 ? (_name != sp._name) : (_id != sp._id))
if (_name != sp._name)
return false;
switch(_type) {
case SP_FLOAT:
Expand All @@ -105,7 +98,7 @@ bool SyntiParameterData::operator==(const SyntiParameterData& sp) const
// write
//---------------------------------------------------------

void SyntiParameterData::write(Xml& xml) const
void SyntiParameter::write(Xml& xml) const
{
if (_type == SP_FLOAT)
xml.tagE(QString("f name=\"%1\" val=\"%3\"").arg(_name).arg(_fval));
Expand All @@ -118,7 +111,7 @@ void SyntiParameterData::write(Xml& xml) const
// for debugging
//---------------------------------------------------------

void SyntiParameterData::print() const
void SyntiParameter::print() const
{
SParmId spid(_id);
if (_type == SP_FLOAT) {
Expand Down Expand Up @@ -182,188 +175,6 @@ void SyntiState::read(XmlReader& e)
}
}

//---------------------------------------------------------
// SyntiParameter
//---------------------------------------------------------

SyntiParameter::SyntiParameter()
{
d = new SyntiParameterData;
}

SyntiParameter::SyntiParameter(const SyntiParameter& sp)
: d(sp.d)
{
}

SyntiParameter::SyntiParameter(const QString& name, float val)
{
d = new SyntiParameterData(name, val);
}

SyntiParameter::SyntiParameter(int id, const QString& name, float val)
{
d = new SyntiParameterData(id, name, val);
}

SyntiParameter::SyntiParameter(const QString& name, const QString& val)
{
d = new SyntiParameterData(name, val);
}

SyntiParameter::SyntiParameter(int id, const QString& name, const QString& val)
{
d = new SyntiParameterData(id, name, val);
}

SyntiParameter::~SyntiParameter()
{
}

//---------------------------------------------------------
// type
//---------------------------------------------------------

SyntiParameterType SyntiParameter::type() const
{
return d->_type;
}

//---------------------------------------------------------
// write
//---------------------------------------------------------

void SyntiParameter::write(Xml& xml) const
{
d->write(xml);
}

//---------------------------------------------------------
// name
//---------------------------------------------------------

const QString& SyntiParameter::name() const
{
return d->_name;
}

void SyntiParameter::setName(const QString& s)
{
d->_name = s;
}

//---------------------------------------------------------
// id
//---------------------------------------------------------

int SyntiParameter::id() const
{
return d->_id;
}

//---------------------------------------------------------
// setId
//---------------------------------------------------------

void SyntiParameter::setId(int v)
{
d->_id = v;
}

//---------------------------------------------------------
// sval
//---------------------------------------------------------

QString SyntiParameter::sval() const
{
return d->_sval;
}

//---------------------------------------------------------
// set
//---------------------------------------------------------

void SyntiParameter::set(const QString& s)
{
d->_sval = s;
}

void SyntiParameter::set(float v)
{
d->_fval = v;
}

void SyntiParameter::set(const QString& s, float v, float min, float max)
{
d->_name = s;
d->_fval = v;
d->_min = min;
d->_max = max;
}

//---------------------------------------------------------
// fval
//---------------------------------------------------------

float SyntiParameter::fval() const
{
return d->_fval;
}

//---------------------------------------------------------
// min
//---------------------------------------------------------

float SyntiParameter::min() const
{
return d->_min;
}

//---------------------------------------------------------
// max
//---------------------------------------------------------

float SyntiParameter::max() const
{
return d->_max;
}

//---------------------------------------------------------
// setRange
//---------------------------------------------------------

void SyntiParameter::setRange(float a, float b)
{
d->_min = a;
d->_max = b;
}

//---------------------------------------------------------
// operator==
//---------------------------------------------------------

bool SyntiParameter::operator==(const SyntiParameter& sp) const
{
return d->operator==(*sp.d);
}

//---------------------------------------------------------
// print
//---------------------------------------------------------

void SyntiParameter::print() const
{
d->print();
}

//---------------------------------------------------------
// SyntiState
//---------------------------------------------------------

SyntiState::SyntiState()
{
}

//---------------------------------------------------------
// operator==
//---------------------------------------------------------
Expand All @@ -380,3 +191,15 @@ bool SyntiState::operator==(const SyntiState& st) const
return true;
}

//---------------------------------------------------------
// set
//---------------------------------------------------------

void SyntiParameter::set(const QString& s, float val, float min, float max)
{
_sval = s;
_fval = val;
_min = min;
_max = max;
}

Loading

0 comments on commit f41fbba

Please sign in to comment.