From 00b569445cf38f20f55602c8144bc04b9198a24b Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Thu, 7 Dec 2006 16:14:23 +0000 Subject: xml lib updates instrument editor updates --- muse/ChangeLog | 2 + muse/al/marker.cpp | 4 +- muse/al/pos.cpp | 8 +- muse/al/sig.cpp | 2 +- muse/al/tempo.cpp | 4 +- muse/al/xml.cpp | 148 ++++++------------- muse/al/xml.h | 9 +- muse/muse/arranger/arranger.cpp | 4 +- muse/muse/conf.cpp | 14 +- muse/muse/ctrl.cpp | 25 ++-- muse/muse/instruments/editinstrument.cpp | 118 ++++++++++++---- muse/muse/instruments/editinstrument.h | 3 +- muse/muse/instruments/editinstrument.ui | 42 +++++- muse/muse/instruments/minstrument.cpp | 58 ++++++-- muse/muse/midictrl.cpp | 34 ++++- muse/muse/midictrl.h | 1 + muse/muse/midiedit/drummap.cpp | 2 +- muse/muse/midiedit/midieditor.cpp | 6 +- muse/muse/midieventbase.cpp | 19 +-- muse/muse/midiplugin.cpp | 19 +-- muse/muse/midirc.cpp | 8 +- muse/muse/midisynti.cpp | 15 +- muse/muse/mixer/mixer.cpp | 2 +- muse/muse/part.cpp | 5 +- muse/muse/plugin.cpp | 10 +- muse/muse/route.cpp | 8 +- muse/muse/synth.cpp | 16 +-- muse/muse/waveedit/waveedit.cpp | 6 +- muse/muse/widgets/editsysexdialogbase.h | 203 -------------------------- muse/muse/widgets/editsysexdialogbase.ui | 236 ------------------------------- muse/synti/deicsonze/deicsonze.cpp | 16 +-- muse/synti/deicsonze/deicsonzepreset.cpp | 38 ++--- muse/synti/vam/vamgui.cpp | 6 +- 33 files changed, 349 insertions(+), 742 deletions(-) delete mode 100644 muse/muse/widgets/editsysexdialogbase.h delete mode 100644 muse/muse/widgets/editsysexdialogbase.ui diff --git a/muse/ChangeLog b/muse/ChangeLog index dd698c7e..ce0fa10a 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,5 @@ +07.12 (ws) + - xml lib cleanups 06.12 (ng) deicsonze - fix pitchbend - fix some logarithm volume issues diff --git a/muse/al/marker.cpp b/muse/al/marker.cpp index 2a0a4a0a..5b4ef87c 100644 --- a/muse/al/marker.cpp +++ b/muse/al/marker.cpp @@ -61,9 +61,9 @@ void MarkerList::write(Xml& xml) const for (ciMarker i = begin(); i != end(); ++i) { const Marker& m = i->second; if (m.type() == TICKS) - xml.tagE("marker tick=\"%d\" name=\"%s\"", m.tick(), m.name().toLatin1().data()); + xml.tagE(QString("marker tick=\"%1\" name=\"%2\"").arg(m.tick()).arg(m.name())); else - xml.tagE("marker sample=\"%d\" name=\"%s\"", m.frame(), m.name().toLatin1().data()); + xml.tagE(QString("marker sample=\"%1\" name=\"%2\"").arg(m.frame()).arg(m.name())); } } diff --git a/muse/al/pos.cpp b/muse/al/pos.cpp index ffd29c3b..31770727 100644 --- a/muse/al/pos.cpp +++ b/muse/al/pos.cpp @@ -289,9 +289,9 @@ void Pos::setFrame(unsigned pos) void Pos::write(Xml& xml, const char* name) const { if (_type == TICKS) - xml.tagE("%s tick=\"%d\"", name, _tick); + xml.tagE(QString("%1 tick=\"%2\"").arg(name).arg(_tick)); else - xml.tagE("%s frame=\"%d\"", name, _frame); + xml.tagE(QString("%1 frame=\"%2\"").arg(name).arg(_frame)); } //--------------------------------------------------------- @@ -373,9 +373,9 @@ void Pos::dump(int /*n*/) const void PosLen::write(Xml& xml, const char* name) const { if (type() == TICKS) - xml.tagE("%s tick=\"%d\" len=\"%d\"", name, tick(), _lenTick); + xml.tagE(QString("%1 tick=\"%2\" len=\"%3\"").arg(name).arg(tick()).arg(_lenTick)); else - xml.tagE("%s sample=\"%d\" len=\"%d\"", name, frame(), _lenFrame); + xml.tagE(QString("%1 sample=\"%2\" len=\"%3\"").arg(name).arg(frame()).arg(_lenFrame)); } //--------------------------------------------------------- diff --git a/muse/al/sig.cpp b/muse/al/sig.cpp index 449cc624..d8672200 100644 --- a/muse/al/sig.cpp +++ b/muse/al/sig.cpp @@ -372,7 +372,7 @@ void SigList::read(QDomNode node) void SigEvent::write(Xml& xml, int at) const { - xml.stag("sig at=\"%d\"", at); + xml.stag(QString("sig at=\"%1\"").arg(at)); xml.tag("tick", tick); xml.tag("nom", sig.z); xml.tag("denom", sig.n); diff --git a/muse/al/tempo.cpp b/muse/al/tempo.cpp index 2d607db0..7d65c732 100644 --- a/muse/al/tempo.cpp +++ b/muse/al/tempo.cpp @@ -318,7 +318,7 @@ unsigned TempoList::frame2tick(unsigned frame, int* sn) const void TempoList::write(Xml& xml) const { - xml.stag("tempolist fix=\"%d\"", _tempo); + xml.stag(QString("tempolist fix=\"%1\"").arg(_tempo)); if (_globalTempo != 100) xml.tag("globalTempo", _globalTempo); for (ciTEvent i = begin(); i != end(); ++i) @@ -362,7 +362,7 @@ void TempoList::read(QDomNode node) void TEvent::write(Xml& xml, int at) const { - xml.stag("tempo at=\"%d\"", at); + xml.stag(QString("tempo at=\"%1\"").arg(at)); xml.tag("tick", tick); xml.tag("val", tempo); xml.etag("tempo"); diff --git a/muse/al/xml.cpp b/muse/al/xml.cpp index 121922a5..329b6c0e 100644 --- a/muse/al/xml.cpp +++ b/muse/al/xml.cpp @@ -55,47 +55,17 @@ void Xml::putLevel() void Xml::header() { - *this << "\n"; + *this << "" << endl; } //--------------------------------------------------------- // put //--------------------------------------------------------- -void Xml::put(const char* format, ...) +void Xml::put(const QString& s) { - va_list args; - va_start(args, format); putLevel(); - char buffer[BS]; - vsnprintf(buffer, BS, format, args); - va_end(args); - *this << buffer; - *this << '\n'; - } - -//--------------------------------------------------------- -// nput -//--------------------------------------------------------- - -void Xml::nput(const char* format, ...) - { - va_list args; - va_start(args, format); - char buffer[BS]; - vsnprintf(buffer, BS, format, args); - *this << buffer; - va_end(args); - } - -//--------------------------------------------------------- -// tdata -//--------------------------------------------------------- - -void Xml::tdata(const QString& s) - { - putLevel(); - *this << s << endl; + *this << xmlString(s) << endl; } //--------------------------------------------------------- @@ -103,20 +73,6 @@ void Xml::tdata(const QString& s) // //--------------------------------------------------------- -void Xml::stag(const char* format, ...) - { - va_list args; - va_start(args, format); - putLevel(); - *this << '<'; - char buffer[BS]; - vsnprintf(buffer, BS, format, args); - *this << buffer; - va_end(args); - *this << '>' << endl; - ++level; - } - void Xml::stag(const QString& s) { putLevel(); @@ -140,19 +96,6 @@ void Xml::etag(const char* s) // //--------------------------------------------------------- -void Xml::tagE(const char* format, ...) - { - va_list args; - va_start(args, format); - putLevel(); - *this << '<'; - char buffer[BS]; - vsnprintf(buffer, BS, format, args); - *this << buffer; - va_end(args); - *this << "/>" << endl; - } - void Xml::tagE(const QString& s) { putLevel(); @@ -162,67 +105,51 @@ void Xml::tagE(const QString& s) void Xml::tag(const char* name, int val) { putLevel(); - *this << "<" << name << ">" << val << "\n"; + *this << '<' << name << '>' << val << "' << endl; } void Xml::tag(const char* name, unsigned val) { putLevel(); - *this << "<" << name << ">" << val << "\n"; + *this << '<' << name << '>' << val << "' << endl; } void Xml::tag(const char* name, float val) { putLevel(); - *this << QString("<%1>%2\n").arg(name).arg(val).arg(name); + *this << '<' << name << '>' << val << "' << endl; } void Xml::tag(const char* name, const double& val) { putLevel(); - QString s("<%1>%2\n"); - *this << s.arg(name).arg(val).arg(name); + *this << '<' << name << '>' << val << "' << endl; } -void Xml::tag(const char* name, const char* s) +void Xml::tag(const char* name, const QString& val) { - tag(name, QString(s)); + putLevel(); + *this << "<" << name << ">" << xmlString(val) << "' << endl; } -//--------------------------------------------------------- -// colorTag -//--------------------------------------------------------- - void Xml::tag(const char* name, const QColor& color) { putLevel(); - char buffer[BS]; - snprintf(buffer, BS, "<%s r=\"%d\" g=\"%d\" b=\"%d\" />\n", - name, color.red(), color.green(), color.blue()); - *this << buffer; + *this << QString("<%1 r=\"%2\" g=\"%3\" b=\"%4\"/>") + .arg(name).arg(color.red()).arg(color.green()).arg(color.blue()) << endl; } -//--------------------------------------------------------- -// geometryTag -//--------------------------------------------------------- - void Xml::tag(const char* name, const QWidget* g) { tag(name, QRect(g->pos(), g->size())); } -//--------------------------------------------------------- -// qrectTag -//--------------------------------------------------------- - void Xml::tag(const char* name, const QRect& r) { putLevel(); *this << "<" << name; - char buffer[BS]; - snprintf(buffer, BS, " x=\"%d\" y=\"%d\" w=\"%d\" h=\"%d\" />\n", - r.x(), r.y(), r.width(), r.height()); - *this << buffer; + *this << QString(" x=\"%1\" y=\"%2\" w=\"%3\" h=\"%4\"/>") + .arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height()) << endl; } //--------------------------------------------------------- @@ -240,18 +167,6 @@ QString Xml::xmlString(const QString& ss) return s; } -//--------------------------------------------------------- -// strTag -//--------------------------------------------------------- - -void Xml::tag(const char* name, const QString& val) - { - putLevel(); - *this << "<" << name << ">"; - *this << xmlString(val) << "\n"; - } - - //--------------------------------------------------------- // readGeometry //--------------------------------------------------------- @@ -304,11 +219,8 @@ void Xml::writeProperties(const QObject* o) { QPoint p = v.toPoint(); putLevel(); - *this << "<" << name; - char buffer[BS]; - snprintf(buffer, BS, " x=\"%d\" y=\"%d\" />\n", - p.x(), p.y()); - *this << buffer; + *this << "<" << name << QString(" x=\"%1\" y=\"%2\" />") + .arg(p.x()).arg(p.y()) << endl; } break; @@ -367,5 +279,33 @@ void readProperties(QObject* o, QDomNode node) if (p.isWritable()) p.write(o, v); } + +//--------------------------------------------------------- +// dump +//--------------------------------------------------------- + +void Xml::dump(int len, const unsigned char* p) + { + putLevel(); + int col = 0; + setFieldWidth(5); + setNumberFlags(numberFlags() | QTextStream::ShowBase); + setIntegerBase(16); + for (int i = 0; i < len; ++i, ++col) { + if (col >= 16) { + setFieldWidth(0); + *this << endl; + col = 0; + putLevel(); + setFieldWidth(5); + } + *this << (p[i] & 0xff); + } + if (col) + *this << endl << dec; + setFieldWidth(0); + setIntegerBase(10); + } + } diff --git a/muse/al/xml.h b/muse/al/xml.h index 6208e8ee..85a125b9 100644 --- a/muse/al/xml.h +++ b/muse/al/xml.h @@ -28,7 +28,6 @@ namespace AL { //--------------------------------------------------------- class Xml : public QTextStream { - static const int BS = 2048; int level; public: @@ -38,27 +37,23 @@ class Xml : public QTextStream { void header(); void putLevel(); - void put(const char* format, ...); - void nput(const char* format, ...); + void put(const QString&); - void stag(const char* format, ...); void stag(const QString&); void etag(const char*); void tagE(const QString&); - void tagE(const char* format, ...); - void tdata(const QString&); void tag(const char* name, int); void tag(const char* name, unsigned); void tag(const char* name, const double& val); void tag(const char* name, float val); - void tag(const char* name, const char* val); void tag(const char* name, const QString& s); void tag(const char* name, const QColor& color); void tag(const char* name, const QWidget* g); void tag(const char* name, const QRect& r); + void dump(int n, const unsigned char*); void writeProperties(const QObject*); static QString xmlString(const QString&); diff --git a/muse/muse/arranger/arranger.cpp b/muse/muse/arranger/arranger.cpp index 66076089..7ca4bb1e 100644 --- a/muse/muse/arranger/arranger.cpp +++ b/muse/muse/arranger/arranger.cpp @@ -1026,12 +1026,12 @@ void Arranger::writeStatus(Xml& xml) for (int i = 0; i < Track::TRACK_TYPES; ++i) { TrGroupList* gl = &glist[i]; - xml.stag("TrackConf type=\"%d\"", i); + xml.stag(QString("TrackConf type=\"%1\"").arg(i)); for (iTrGroup ig = gl->begin(); ig != gl->end(); ++ig) { TrElementList& el = *ig; xml.stag("group"); for (iTrElement ie = el.begin(); ie != el.end(); ++ie) - xml.tagE("element id=\"%d\"", (*ie)->id); + xml.tagE(QString("element id=\"%1\"").arg((*ie)->id)); xml.etag("group"); } xml.etag("TrackConf"); diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp index b926ddb5..e53ea2c5 100644 --- a/muse/muse/conf.cpp +++ b/muse/muse/conf.cpp @@ -433,9 +433,9 @@ void MusE::writeGlobalConfiguration(Xml& xml) const xml.tag("mtctype", AL::mtcType); xml.stag("mtcoffset"); - xml.put("%02d:%02d:%02d:%02d:%02d", - mtcOffset.h(), mtcOffset.m(), mtcOffset.s(), - mtcOffset.f(), mtcOffset.sf()); + xml.put(QString("%1:%2:%3:%4:%5") + .arg(mtcOffset.h()).arg(mtcOffset.m()).arg(mtcOffset.s()) + .arg(mtcOffset.f()).arg(mtcOffset.sf())); xml.etag("mtcoffset"); xml.tag("extSync", extSyncFlag); @@ -503,9 +503,9 @@ void MusE::writeConfiguration(Xml& xml) const xml.tag("mtctype", AL::mtcType); xml.stag("mtcoffset"); - xml.put("%02d:%02d:%02d:%02d:%02d", - mtcOffset.h(), mtcOffset.m(), mtcOffset.s(), - mtcOffset.f(), mtcOffset.sf()); + xml.put(QString("%1:%2:%3:%4:%5") + .arg(mtcOffset.h()).arg(mtcOffset.m()).arg(mtcOffset.s()) + .arg(mtcOffset.f()).arg(mtcOffset.sf())); xml.etag("mtcoffset"); xml.tag("extSync", extSyncFlag); xml.tag("genMTCSync", genMTCSync); @@ -657,7 +657,7 @@ void MidiFileConfig::cancelClicked() void MixerConfig::write(Xml& xml, const char* name) { - xml.stag("%s", name); + xml.stag(QString(name)); xml.tag("geometry", geometry); xml.tag("showMidiTracks", showMidiTracks); xml.tag("showMidiSyntiPorts", showMidiSyntiPorts); diff --git a/muse/muse/ctrl.cpp b/muse/muse/ctrl.cpp index e6f6540b..bb1a7ac2 100644 --- a/muse/muse/ctrl.cpp +++ b/muse/muse/ctrl.cpp @@ -264,17 +264,19 @@ void Ctrl::write(Xml& xml) { QString s("controller id=\"%1\" name=\"%2\" cur=\"%3\" type=\"%4\" min=\"%5\" max=\"%6\" default=\"%7\""); + QString cn = Xml::xmlString(_name); + if (empty()) { if (_type & INT) - xml.tagE(s.arg(id()).arg(_name).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data()); + xml.tagE(s.arg(id()).arg(cn).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data()); else - xml.tagE(s.arg(id()).arg(_name).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data()); + xml.tagE(s.arg(id()).arg(cn).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data()); return; } if (_type & INT) - xml.stag(s.arg(id()).arg(_name).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data()); + xml.stag(s.arg(id()).arg(cn).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data()); else - xml.stag(s.arg(id()).arg(_name).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data()); + xml.stag(s.arg(id()).arg(cn).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data()); int i = 0; for (ciCtrlVal ic = begin(); ic != end(); ++ic) { @@ -285,23 +287,18 @@ void Ctrl::write(Xml& xml) if (_type & LOG) val.f = (val.f <= -1000.0) ? 0.0f : pow(10.0f, val.f); if (_type & INT) { - xml.nput("%d %d,", time, val.i); - } - else { - QString fval,ttime; - fval.setNum(val.f); - ttime.setNum(time); - QString str=ttime + " "+ fval + ","; - xml.nput(str.toAscii().data()); + xml << time << ' ' << val.i << ','; } + else + xml << time << ' ' << val.f << ','; ++i; if (i >= 4) { - xml.nput("\n"); + xml << endl; i = 0; } } if (i) - xml.nput("\n"); + xml << endl; xml.etag("controller"); } diff --git a/muse/muse/instruments/editinstrument.cpp b/muse/muse/instruments/editinstrument.cpp index 0a39e66b..90400587 100644 --- a/muse/muse/instruments/editinstrument.cpp +++ b/muse/muse/instruments/editinstrument.cpp @@ -25,6 +25,9 @@ #include "al/xml.h" #include "gconfig.h" +extern int string2sysex(const QString& s, unsigned char** data); +extern QString sysex2string(int len, unsigned char* data); + //--------------------------------------------------------- // EditInstrument //--------------------------------------------------------- @@ -47,7 +50,7 @@ EditInstrument::EditInstrument(QWidget* parent) SLOT(patchChanged(QTreeWidgetItem*, QTreeWidgetItem*))); instrumentChanged(instrumentList->item(0), instrumentList->item(0)); connect(listController, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - SLOT(controllerChanged(QListWidgetItem*))); + SLOT(controllerChanged(QListWidgetItem*, QListWidgetItem*))); connect(sysexList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(sysexChanged(QListWidgetItem*, QListWidgetItem*))); connect(instrumentName, SIGNAL(textChanged(const QString&)), SLOT(instrumentNameChanged(const QString&))); @@ -63,6 +66,8 @@ EditInstrument::EditInstrument(QWidget* parent) connect(newController, SIGNAL(clicked()), SLOT(newControllerClicked())); connect(deleteSysex, SIGNAL(clicked()), SLOT(deleteSysexClicked())); connect(newSysex, SIGNAL(clicked()), SLOT(newSysexClicked())); + + connect(ctrlType,SIGNAL(activated(int)), SLOT(ctrlTypeChanged(int))); } //--------------------------------------------------------- @@ -519,17 +524,17 @@ void EditInstrument::instrumentChanged(QListWidgetItem* sel, QListWidgetItem* ol foreach(const SysEx* s, instrument->sysex()) { QListWidgetItem* item = new QListWidgetItem(s->name); - QVariant v = QVariant::fromValue((void*)item); + QVariant v = QVariant::fromValue((void*)s); item->setData(Qt::UserRole, v); sysexList->addItem(item); } - if (!instrument->sysex().isEmpty()) { - sysexList->setItemSelected(sysexList->item(0), true); - sysexChanged(sysexList->item(0), 0); - } + + sysexList->setItemSelected(sysexList->item(0), true); + sysexChanged(sysexList->item(0), 0); + if (!cl->empty()) { listController->setItemSelected(listController->item(0), true); - controllerChanged(listController->item(0)); + controllerChanged(listController->item(0), 0); } } @@ -548,18 +553,22 @@ void EditInstrument::patchChanged(QTreeWidgetItem* sel, QTreeWidgetItem* old) if (p->name != patchNameEdit->text()) { p->name = patchNameEdit->text(); instrument->setDirty(true); +printf("patch mod 1\n"); } if (p->hbank != spinBoxHBank->value()) { p->hbank = spinBoxHBank->value(); instrument->setDirty(true); +printf("patch mod 2\n"); } if (p->lbank != spinBoxLBank->value()) { p->hbank = spinBoxHBank->value(); instrument->setDirty(true); +printf("patch mod 3\n"); } if (p->prog != spinBoxProgram->value()) { p->prog = spinBoxProgram->value(); instrument->setDirty(true); +printf("patch mod 4\n"); } // there is no logical xor in c++ bool a = p->typ & 1; @@ -604,39 +613,52 @@ void EditInstrument::patchChanged(QTreeWidgetItem* sel, QTreeWidgetItem* old) // controllerChanged //--------------------------------------------------------- -void EditInstrument::controllerChanged(QListWidgetItem* sel) +void EditInstrument::controllerChanged(QListWidgetItem* sel, QListWidgetItem* old) { + if (old) { + QListWidgetItem* item = instrumentList->currentItem(); + if (item == 0) + return; + MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value(); + MidiController* oc = (MidiController*)old->data(Qt::UserRole).value(); + int ctrlH = spinBoxHCtrlNo->value(); + int ctrlL = spinBoxLCtrlNo->value(); + MidiController::ControllerType type = (MidiController::ControllerType)ctrlType->currentIndex(); + int num = MidiController::genNum(type, ctrlH, ctrlL); + + if (num != oc->num()) { + oc->setNum(num); + instrument->setDirty(true); + } + if (spinBoxMin->value() != oc->minVal()) { + oc->setMinVal(spinBoxMin->value()); + instrument->setDirty(true); + } + if (spinBoxMax->value() != oc->maxVal()) { + oc->setMaxVal(spinBoxMax->value()); + instrument->setDirty(true); + } + if (spinBoxDefault->value() != oc->initVal()) { + oc->setInitVal(spinBoxDefault->value()); + instrument->setDirty(true); + } + } if (sel == 0 || sel->data(Qt::UserRole).value() == 0) { // patchNameEdit->setText(""); return; } MidiController* c = (MidiController*)sel->data(Qt::UserRole).value(); entryName->setText(c->name()); - MidiController::ControllerType type = c->type(); - switch(type) { - case MidiController::Controller7: - spinBoxHCtrlNo->setEnabled(false); - break; - case MidiController::Controller14: - case MidiController::RPN: - case MidiController::NRPN: - case MidiController::RPN14: - case MidiController::NRPN14: - spinBoxHCtrlNo->setEnabled(true); - break; - case MidiController::Pitch: - case MidiController::Program: - case MidiController::Velo: - break; - } - int ctrlH = (c->num() >> 8) & 0x7f; int ctrlL = c->num() & 0x7f; - spinBoxType->setCurrentIndex(int(type)); + int type = int(c->type()); + ctrlType->setCurrentIndex(type); + ctrlTypeChanged(type); spinBoxHCtrlNo->setValue(ctrlH); spinBoxLCtrlNo->setValue(ctrlL); spinBoxMin->setValue(c->minVal()); spinBoxMax->setValue(c->maxVal()); + spinBoxDefault->setRange(c->minVal()-1, c->maxVal()); spinBoxDefault->setValue(c->initVal()); } @@ -655,12 +677,20 @@ void EditInstrument::sysexChanged(QListWidgetItem* sel, QListWidgetItem* old) if (sysexName->text() != so->name) { so->name = sysexName->text(); instrument->setDirty(true); +printf("sysex mod 1\n"); } if (sysexComment->toPlainText() != so->comment) { so->comment = sysexComment->toPlainText(); instrument->setDirty(true); +printf("sysex mod 2\n"); + } + unsigned char* data; + int len = string2sysex(sysexData->toPlainText(), &data); + if (so->dataLen != len || !memcmp(data, so->data, len)) { + delete so->data; + so->data = data; + so->dataLen = len; } - // TODO: check hex values } if (sel == 0) { sysexName->setText(""); @@ -674,9 +704,11 @@ void EditInstrument::sysexChanged(QListWidgetItem* sel, QListWidgetItem* old) sysexName->setEnabled(true); sysexComment->setEnabled(true); sysexData->setEnabled(true); + SysEx* sx = (SysEx*)sel->data(Qt::UserRole).value(); sysexName->setText(sx->name); sysexComment->setText(sx->comment); + sysexData->setText(sysex2string(sx->dataLen, sx->data)); } //--------------------------------------------------------- @@ -710,3 +742,33 @@ bool EditInstrument::checkDirty(MidiInstrument* i) return n == 2; } +//--------------------------------------------------------- +// ctrlTypeChanged +//--------------------------------------------------------- + +void EditInstrument::ctrlTypeChanged(int idx) + { + MidiController::ControllerType t = (MidiController::ControllerType)idx; + switch (t) { + case MidiController::RPN: + case MidiController::NRPN: + case MidiController::Controller7: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(true); + break; + case MidiController::Controller14: + case MidiController::RPN14: + case MidiController::NRPN14: + spinBoxHCtrlNo->setEnabled(true); + spinBoxLCtrlNo->setEnabled(true); + break; + case MidiController::Pitch: + case MidiController::Program: + spinBoxHCtrlNo->setEnabled(false); + spinBoxLCtrlNo->setEnabled(false); + break; + default: + break; + } + } + diff --git a/muse/muse/instruments/editinstrument.h b/muse/muse/instruments/editinstrument.h index f1bd7766..1b38fb26 100644 --- a/muse/muse/instruments/editinstrument.h +++ b/muse/muse/instruments/editinstrument.h @@ -42,7 +42,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { virtual void fileSaveAs(); void instrumentChanged(QListWidgetItem*, QListWidgetItem*); void patchChanged(QTreeWidgetItem*, QTreeWidgetItem*); - void controllerChanged(QListWidgetItem* sel); + void controllerChanged(QListWidgetItem*, QListWidgetItem*); void sysexChanged(QListWidgetItem*, QListWidgetItem*); void instrumentNameChanged(const QString&); void deletePatchClicked(); @@ -53,6 +53,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { void newControllerClicked(); void deleteSysexClicked(); void newSysexClicked(); + void ctrlTypeChanged(int); public: EditInstrument(QWidget* parent = 0); diff --git a/muse/muse/instruments/editinstrument.ui b/muse/muse/instruments/editinstrument.ui index 2a7b525a..7c071290 100644 --- a/muse/muse/instruments/editinstrument.ui +++ b/muse/muse/instruments/editinstrument.ui @@ -25,7 +25,22 @@ Qt::Horizontal - + + + + 5 + 7 + 0 + 0 + + + + QListView::Adjust + + + QListView::Batched + + @@ -57,7 +72,7 @@ - 0 + 1 @@ -78,7 +93,7 @@ - 7 + 5 7 0 0 @@ -479,7 +494,7 @@ handled like normal controllers. 6 - + Controller-7Bit @@ -624,7 +639,7 @@ handled like normal controllers. - 16384 + 8388607 -16385 @@ -642,7 +657,14 @@ handled like normal controllers. - + + + ?? + + + -1 + + @@ -734,12 +756,18 @@ handled like normal controllers. - 1 + 7 7 0 0 + + QListView::Adjust + + + true + diff --git a/muse/muse/instruments/minstrument.cpp b/muse/muse/instruments/minstrument.cpp index 3e353a13..e4044056 100644 --- a/muse/muse/instruments/minstrument.cpp +++ b/muse/muse/instruments/minstrument.cpp @@ -34,19 +34,57 @@ MidiInstrument* genericMidiInstrument; // string2sysex //--------------------------------------------------------- -int string2sysex(const QString&, unsigned char** data) +int string2sysex(const QString& s, unsigned char** data) { - *data = 0; - return 0; + const char* src = s.toLatin1().data(); + char buffer[2048]; + char* dst = buffer; + + while (*src) { + while (*src == ' ' || *src == '\n') + ++src; + char* ep; + long val = strtol(src, &ep, 16); + if (ep == src) { + QMessageBox::information(0, + QString("MusE"), + QWidget::tr("Cannot convert sysex string")); + return 0; + } + src = ep; + *dst++ = val; + if (dst - buffer >= 2048) { + QMessageBox::information(0, + QString("MusE"), + QWidget::tr("Hex String too long (2048 bytes limit)")); + return 0; + } + } + int len = dst - buffer; + unsigned char* b = new unsigned char[len+1]; + memcpy(b, buffer, len); + b[len] = 0; + *data = b; + return len; } //--------------------------------------------------------- // sysex2string //--------------------------------------------------------- -QString sysex2string(int, unsigned char*) +QString sysex2string(int len, unsigned char* data) { - return QString(""); + QString d; + QString s; + for (int i = 0; i < len; ++i) { + if ((i > 0) && ((i % 8)==0)) { + d += "\n"; + } + else if (i) + d += " "; + d += s.sprintf("%02x", data[i]); + } + return d; } //--------------------------------------------------------- @@ -321,14 +359,14 @@ void Patch::read(QDomNode node, bool dr, MidiInstrument* instrument) void Patch::write(Xml& xml) { if (drumMap == 0) { - QString s = QString("Patch name=\"%1\"").arg(name); + QString s = QString("Patch name=\"%1\"").arg(Xml::xmlString(name)); if (typ != -1) s += QString(" mode=\"%d\"").arg(typ); s += QString(" hbank=\"%1\" lbank=\"%2\" prog=\"%3\"").arg(hbank).arg(lbank).arg(prog); xml.tagE(s); return; } - QString s = QString("drummap name=\"%1\"").arg(name); + QString s = QString("drummap name=\"%1\"").arg(Xml::xmlString(name)); s += QString(" hbank=\"%1\" lbank=\"%2\" prog=\"%3\"").arg(hbank).arg(lbank).arg(prog); xml.stag(s); for (int i = 0; i < DRUM_MAPSIZE; ++i) { @@ -559,14 +597,14 @@ void MidiInstrument::write(Xml& xml) { xml.header(); xml.stag("muse version=\"2.1\""); - xml.stag("MidiInstrument name=\"%s\"", iname().toUtf8().data()); + xml.stag(QString("MidiInstrument name=\"%1\"").arg(Xml::xmlString(iname()))); foreach(const QString& s, _categories) - xml.tagE("Category name=\"%s\"", s.toUtf8().data()); + xml.tagE(QString("Category name=\"%1\"").arg(Xml::xmlString(s))); std::vector* pg = groups(); for (std::vector::iterator g = pg->begin(); g != pg->end(); ++g) { - xml.stag("PatchGroup name=\"%s\"", g->name.toUtf8().data()); + xml.stag(QString("PatchGroup name=\"%1\"").arg(Xml::xmlString(g->name))); for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) (*p)->write(xml); xml.etag("PatchGroup"); diff --git a/muse/muse/midictrl.cpp b/muse/muse/midictrl.cpp index b9a629d5..409316d9 100644 --- a/muse/muse/midictrl.cpp +++ b/muse/muse/midictrl.cpp @@ -245,8 +245,8 @@ void MidiController::write(Xml& xml) const else sl.setNum(l); - xml.tagE("Controller name=\"%s\" type=\"%s\" h=\"%d\" l=\"%s\" min=\"%d\" max\"%d\" init=\"%d\"", - _name.toLatin1().data(), type.toLatin1().data(), h, sl.toLatin1().data(), _minVal, _maxVal, _initVal); + xml.tagE(QString("Controller name=\"%1\" type=\"%2\" h=\"%3\" l=\"%4\" min=\"%5\" max\"%6\" init=\"%7\"") + .arg(Xml::xmlString(_name)).arg(type).arg(h).arg(sl).arg(_minVal).arg(_maxVal).arg(_initVal)); } //--------------------------------------------------------- @@ -330,3 +330,33 @@ MidiController::ControllerType MidiController::type() const return midiControllerType(num()); } +//--------------------------------------------------------- +// genNum +//--------------------------------------------------------- + + +int MidiController::genNum(MidiController::ControllerType t, int h, int l) + { + int val = (h << 8) + l; + switch(t) { + case Controller7: + return l; + case Controller14: + return val + CTRL_14_OFFSET; + case RPN: + return l + CTRL_RPN_OFFSET; + case NRPN: + return l + CTRL_NRPN_OFFSET; + case RPN14: + return val + CTRL_RPN14_OFFSET; + case NRPN14: + return val + CTRL_NRPN14_OFFSET; + case Pitch: + return CTRL_PITCH; + case Program: + return CTRL_PROGRAM; + default: + return -1; + } + } + diff --git a/muse/muse/midictrl.h b/muse/muse/midictrl.h index 067aad6a..4ffaa017 100644 --- a/muse/muse/midictrl.h +++ b/muse/muse/midictrl.h @@ -132,6 +132,7 @@ class MidiController { void setMinVal(int val) { _minVal = val; } void setMaxVal(int val) { _maxVal = val; } ControllerType type() const; + static int genNum(ControllerType, int, int); }; //--------------------------------------------------------- diff --git a/muse/muse/midiedit/drummap.cpp b/muse/muse/midiedit/drummap.cpp index 2e15786b..978c7dab 100644 --- a/muse/muse/midiedit/drummap.cpp +++ b/muse/muse/midiedit/drummap.cpp @@ -187,7 +187,7 @@ void DrumMapEntry::read(QDomNode n) break; } } - if (anote = -1) + if (anote == -1) anote = enote; } diff --git a/muse/muse/midiedit/midieditor.cpp b/muse/muse/midiedit/midieditor.cpp index 4b7fd60b..d004ef29 100644 --- a/muse/muse/midiedit/midieditor.cpp +++ b/muse/muse/midiedit/midieditor.cpp @@ -195,7 +195,7 @@ void MidiEditor::writePartList(Xml& xml) const int trkIdx = song->tracks()->indexOf(track); int partIdx = track->parts()->index(part); xml.stag("part"); - xml.put("%d:%d", trkIdx, partIdx); + xml.put(QString("%1:%2").arg(trkIdx).arg(partIdx)); xml.etag("part"); } } @@ -417,8 +417,8 @@ void MidiEditor::write(Xml& xml) const xml.writeProperties(this); const CtrlEditList* el = canvas()->getCtrlEditors(); for (ciCtrlEdit i = el->begin(); i != el->end(); ++i) { - xml.tagE("CtrlEdit h=\"%d\" id=\"%d\"", - (*i)->height(), (*i)->ctrl()->id()); + xml.tagE(QString("CtrlEdit h=\"%1\" id=\"%2\"") + .arg((*i)->height()).arg((*i)->ctrl()->id())); } xml.etag(metaObject()->className()); } diff --git a/muse/muse/midieventbase.cpp b/muse/muse/midieventbase.cpp index c98fa6ec..f37649d8 100644 --- a/muse/muse/midieventbase.cpp +++ b/muse/muse/midieventbase.cpp @@ -100,21 +100,8 @@ void MidiEventBase::write(Xml& xml, const Pos& offset) const } if (edata.dataLen) { s += QString(" datalen=\"%1\"").arg(edata.dataLen); - xml.stag(s.toLatin1().data()); - QString data; - - int col = 0; - xml.putLevel(); - for (int i = 0; i < edata.dataLen; ++i, ++col) { - if (col >= 16) { - xml.put(""); - col = 0; - xml.putLevel(); - } - xml.nput("%02x ", edata.data[i] & 0xff); - } - if (col) - xml.put(""); + xml.stag(s); + xml.dump(edata.dataLen, edata.data); xml.etag("event"); } else { @@ -124,7 +111,7 @@ void MidiEventBase::write(Xml& xml, const Pos& offset) const s += QString(" b=\"%1\"").arg(b); if (c) s += QString(" c=\"%1\"").arg(c); - xml.tagE(s.toLatin1().data()); + xml.tagE(s); } } diff --git a/muse/muse/midiplugin.cpp b/muse/muse/midiplugin.cpp index 22dda972..1d13828d 100644 --- a/muse/muse/midiplugin.cpp +++ b/muse/muse/midiplugin.cpp @@ -417,8 +417,8 @@ void MidiPluginI::apply(unsigned from, unsigned to, MidiEventList* il, MidiEvent void MidiPluginI::writeConfiguration(Xml& xml) { - xml.stag("midiPlugin file=\"%s\" name=\"%s\"", - _plugin->lib().toLatin1().data(), _plugin->name().toLatin1().data()); + xml.stag(QString("midiPlugin file=\"%1\" name=\"%2\"") + .arg(_plugin->lib()).arg(_plugin->name())); if (_on == false) xml.tag("on", _on); if (mempi->hasGui()) { @@ -439,19 +439,8 @@ void MidiPluginI::writeConfiguration(Xml& xml) const unsigned char* p; mempi->getInitData(&len, &p); if (len) { - xml.stag("init len=\"%d\"", len); - int col = 0; - xml.putLevel(); - for (int i = 0; i < len; ++i, ++col) { - if (col >= 16) { - xml.put(""); - col = 0; - xml.putLevel(); - } - xml.nput("%02x ", p[i] & 0xff); - } - if (col) - xml.put(""); + xml.stag(QString("init len=\"%1\"").arg(len)); + xml.dump(len, p); xml.etag("init"); } xml.etag("midiPlugin"); diff --git a/muse/muse/midirc.cpp b/muse/muse/midirc.cpp index 20e530b4..14b69d55 100644 --- a/muse/muse/midirc.cpp +++ b/muse/muse/midirc.cpp @@ -165,12 +165,12 @@ void MidiRCList::write(Xml& xml) { xml.stag("midiRC"); for (iMidiRC i = begin(); i != end(); ++i) { - xml.stag("action id=\"%d\"", i->action); + xml.stag(QString("action id=\"%1\"").arg(i->action)); if (i->event.type() == ME_NOTEON) - xml.stag("noteOn pitch=\"%d\"", i->event.dataA()); + xml.stag(QString("noteOn pitch=\"%1\"").arg(i->event.dataA())); else if (i->event.type() == ME_CONTROLLER) - xml.stag("controller no=\"%d\" val=\"%d\"", - i->event.dataA(), i->event.dataB()); + xml.stag(QString("controller no=\"%1\" val=\"%2\"") + .arg(i->event.dataA()).arg(i->event.dataB())); else printf("remote event type %d not supported\n", i->event.type()); xml.etag("action"); diff --git a/muse/muse/midisynti.cpp b/muse/muse/midisynti.cpp index 0aa695ce..b53693af 100644 --- a/muse/muse/midisynti.cpp +++ b/muse/muse/midisynti.cpp @@ -112,19 +112,8 @@ void MidiSynti::write(Xml& xml) const const unsigned char* p; _synti->getInitData(&len, &p); if (len) { - xml.stag("init len=\"%d\"", len); - int col = 0; - xml.putLevel(); - for (int i = 0; i < len; ++i, ++col) { - if (col >= 16) { - xml.put(""); - col = 0; - xml.putLevel(); - } - xml.nput("%02x ", p[i] & 0xff); - } - if (col) - xml.put(""); + xml.stag(QString("init len=\"%1\"").arg(len)); + xml.dump(len, p); xml.etag("init"); } xml.etag("MidiSynti"); diff --git a/muse/muse/mixer/mixer.cpp b/muse/muse/mixer/mixer.cpp index f7116d43..d4835bba 100644 --- a/muse/muse/mixer/mixer.cpp +++ b/muse/muse/mixer/mixer.cpp @@ -372,7 +372,7 @@ void Mixer::showTracksChanged(QAction* id) void Mixer::write(Xml& xml, const char* name) { - xml.stag("%s", name); + xml.stag(QString(name)); xml.tag("geometry", geometry()); xml.tag("showMidiTracks", cfg->showMidiTracks); xml.tag("showOutputTracks", cfg->showOutputTracks); diff --git a/muse/muse/part.cpp b/muse/muse/part.cpp index 30daed4f..419c72bb 100644 --- a/muse/muse/part.cpp +++ b/muse/muse/part.cpp @@ -210,7 +210,7 @@ void Part::write(Xml& xml) } if (id != -1) - xml.stag("part cloneId=\"%d\"", id); + xml.stag(QString("part cloneId=\"%1\"").arg(id)); else xml.stag("part"); if (!_name.isEmpty()) @@ -227,8 +227,7 @@ void Part::write(Xml& xml) if (_xmag != -1.0) xml.tag("xmag", _xmag); for (ciCtrlCanvas i = ctrlCanvasList.begin(); i != ctrlCanvasList.end(); ++i) - xml.tagE("CtrlCanvas h=\"%d\" id=\"%d\"", - i->height, i->ctrlId); + xml.tagE(QString("CtrlCanvas h=\"%1\" id=\"%2\"").arg(i->height).arg(i->ctrlId)); if (_fillLen) xml.tag("fillLen", _fillLen); if (_mute) diff --git a/muse/muse/plugin.cpp b/muse/muse/plugin.cpp index 4703d15e..eb8d9160 100644 --- a/muse/muse/plugin.cpp +++ b/muse/muse/plugin.cpp @@ -308,11 +308,11 @@ void PluginI::writeConfiguration(Xml& xml, bool prefader) void PluginI::writeConfiguration1(Xml& xml, bool prefader) { - xml.stag("plugin pre=\"%d\" file=\"%s\" label=\"%s\" channel=\"%d\"", - prefader, - _plugin->lib().toLatin1().data(), - _plugin->label().toLatin1().data(), - _channel); + xml.stag(QString("plugin pre=\"%1\" file=\"%2\" label=\"%3\" channel=\"%4\"") + .arg(prefader) + .arg(_plugin->lib()) + .arg(_plugin->label()) + .arg(_channel)); // instances * _plugin->inports()); if (_on == false) xml.tag("on", _on); diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp index 127a2f4c..7808a088 100644 --- a/muse/muse/route.cpp +++ b/muse/muse/route.cpp @@ -345,11 +345,11 @@ const char* RouteNode::tname() const void RouteNode::write(Xml& xml, const char* label) const { if (channel != -1) - xml.put("<%s type=\"%s\" channel=\"%d\" name=\"%s\"/>", - label, tname(), channel + 1, name().toUtf8().data()); + xml.put(QString("<%1 type=\"%2\" channel=\"%3\" name=\"%4\"/>") + .arg(label).arg(tname()).arg(channel + 1).arg(name())); else - xml.put("<%s type=\"%s\" name=\"%s\"/>", - label, tname(), name().toUtf8().data()); + xml.put(QString("<%1 type=\"%2\" name=\"%3\"/>") + .arg(label).arg(tname()).arg(name())); } //--------------------------------------------------------- diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp index 208b24f4..1701c6df 100644 --- a/muse/muse/synth.cpp +++ b/muse/muse/synth.cpp @@ -401,19 +401,9 @@ void MessSynthIF::write(Xml& xml) const _mess->getInitData(&len, &p); if (len) { xml.stag("midistate"); - xml.stag("event type=\"%d\" datalen=\"%d\"", Sysex, len); + xml.stag(QString("event type=\"%1\" datalen=\"%2\"").arg(Sysex).arg(len)); int col = 0; - xml.putLevel(); - for (int i = 0; i < len; ++i, ++col) { - if (col >= 16) { - xml.put(""); - col = 0; - xml.putLevel(); - } - xml.nput("%02x ", p[i] & 0xff); - } - if (col) - xml.put(""); + xml.dump(len, p); xml.etag("event"); xml.etag("midistate"); } @@ -583,8 +573,6 @@ bool MessSynthIF::putEvent(const MidiEvent& ev) printf("MidiOut<%s>", synti->name().toLatin1().data()); ev.dump(); } -if (rv) - printf("SYNT BUSY\n"); } return rv; } diff --git a/muse/muse/waveedit/waveedit.cpp b/muse/muse/waveedit/waveedit.cpp index c54265a0..3bfbbe40 100644 --- a/muse/muse/waveedit/waveedit.cpp +++ b/muse/muse/waveedit/waveedit.cpp @@ -273,15 +273,15 @@ void WaveEdit::write(Xml& xml) const int trkIdx = song->tracks()->indexOf(track); int partIdx = track->parts()->index(part); xml.stag("part"); - xml.put("%d:%d", trkIdx, partIdx); + xml.put(QString("%1:%2").arg(trkIdx).arg(partIdx)); xml.etag("part"); } xml.stag(metaObject()->className()); xml.writeProperties(this); const CtrlEditList* el = view->getCtrlEditors(); for (ciCtrlEdit i = el->begin(); i != el->end(); ++i) { - xml.tagE("CtrlEdit h=\"%d\" id=\"%d\"", - (*i)->height(), (*i)->ctrl()->id()); + xml.tagE(QString("CtrlEdit h=\"%1\" id=\"%2\"") + .arg((*i)->height()).arg((*i)->ctrl()->id())); } xml.etag(metaObject()->className()); } diff --git a/muse/muse/widgets/editsysexdialogbase.h b/muse/muse/widgets/editsysexdialogbase.h deleted file mode 100644 index b00b09b6..00000000 --- a/muse/muse/widgets/editsysexdialogbase.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef EDITSYSEXDIALOGBASE_H -#define EDITSYSEXDIALOGBASE_H - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "awl/posedit.h" -#include -#include - -class Ui_EditSysexDialogBase -{ -public: - QVBoxLayout *vboxLayout; - QHBoxLayout *hboxLayout; - QVBoxLayout *vboxLayout1; - QLabel *textLabel1; - Q3ListBox *sysexList; - QVBoxLayout *vboxLayout2; - QHBoxLayout *hboxLayout1; - QLabel *TextLabel1; - Awl::PosEdit *pos; - QSpacerItem *spacerItem; - Q3TextEdit *edit; - QLabel *TextLabel2; - Q3TextEdit *comment; - QHBoxLayout *hboxLayout2; - QPushButton *buttonAdd; - QSpacerItem *spacerItem1; - QPushButton *buttonOk; - QPushButton *buttonCancel; - - void setupUi(QDialog *EditSysexDialogBase) - { - EditSysexDialogBase->setObjectName(QString::fromUtf8("EditSysexDialogBase")); - EditSysexDialogBase->resize(QSize(667, 556).expandedTo(EditSysexDialogBase->minimumSizeHint())); - EditSysexDialogBase->setSizeGripEnabled(true); - vboxLayout = new QVBoxLayout(EditSysexDialogBase); - vboxLayout->setSpacing(6); - vboxLayout->setMargin(11); - vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); - hboxLayout = new QHBoxLayout(); - hboxLayout->setSpacing(6); - hboxLayout->setMargin(0); - hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); - vboxLayout1 = new QVBoxLayout(); - vboxLayout1->setSpacing(6); - vboxLayout1->setMargin(0); - vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1")); - textLabel1 = new QLabel(EditSysexDialogBase); - textLabel1->setObjectName(QString::fromUtf8("textLabel1")); - QSizePolicy sizePolicy((QSizePolicy::Policy)4, (QSizePolicy::Policy)5); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(textLabel1->sizePolicy().hasHeightForWidth()); - textLabel1->setSizePolicy(sizePolicy); - - vboxLayout1->addWidget(textLabel1); - - sysexList = new Q3ListBox(EditSysexDialogBase); - sysexList->setObjectName(QString::fromUtf8("sysexList")); - QSizePolicy sizePolicy1((QSizePolicy::Policy)4, (QSizePolicy::Policy)7); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(sysexList->sizePolicy().hasHeightForWidth()); - sysexList->setSizePolicy(sizePolicy1); - - vboxLayout1->addWidget(sysexList); - - - hboxLayout->addLayout(vboxLayout1); - - vboxLayout2 = new QVBoxLayout(); - vboxLayout2->setSpacing(6); - vboxLayout2->setMargin(0); - vboxLayout2->setObjectName(QString::fromUtf8("vboxLayout2")); - hboxLayout1 = new QHBoxLayout(); - hboxLayout1->setSpacing(6); - hboxLayout1->setMargin(0); - hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1")); - TextLabel1 = new QLabel(EditSysexDialogBase); - TextLabel1->setObjectName(QString::fromUtf8("TextLabel1")); - - hboxLayout1->addWidget(TextLabel1); - - pos = new Awl::PosEdit(EditSysexDialogBase); - pos->setObjectName(QString::fromUtf8("pos")); - - hboxLayout1->addWidget(pos); - - spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - hboxLayout1->addItem(spacerItem); - - - vboxLayout2->addLayout(hboxLayout1); - - edit = new Q3TextEdit(EditSysexDialogBase); - edit->setObjectName(QString::fromUtf8("edit")); - - vboxLayout2->addWidget(edit); - - TextLabel2 = new QLabel(EditSysexDialogBase); - TextLabel2->setObjectName(QString::fromUtf8("TextLabel2")); - - vboxLayout2->addWidget(TextLabel2); - - comment = new Q3TextEdit(EditSysexDialogBase); - comment->setObjectName(QString::fromUtf8("comment")); - - vboxLayout2->addWidget(comment); - - - hboxLayout->addLayout(vboxLayout2); - - - vboxLayout->addLayout(hboxLayout); - - hboxLayout2 = new QHBoxLayout(); - hboxLayout2->setSpacing(6); - hboxLayout2->setMargin(0); - hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2")); - buttonAdd = new QPushButton(EditSysexDialogBase); - buttonAdd->setObjectName(QString::fromUtf8("buttonAdd")); - QSizePolicy sizePolicy2((QSizePolicy::Policy)1, (QSizePolicy::Policy)0); - sizePolicy2.setHorizontalStretch(0); - sizePolicy2.setVerticalStretch(0); - sizePolicy2.setHeightForWidth(buttonAdd->sizePolicy().hasHeightForWidth()); - buttonAdd->setSizePolicy(sizePolicy2); - - hboxLayout2->addWidget(buttonAdd); - - spacerItem1 = new QSpacerItem(350, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - hboxLayout2->addItem(spacerItem1); - - buttonOk = new QPushButton(EditSysexDialogBase); - buttonOk->setObjectName(QString::fromUtf8("buttonOk")); - buttonOk->setAutoDefault(true); - buttonOk->setDefault(true); - - hboxLayout2->addWidget(buttonOk); - - buttonCancel = new QPushButton(EditSysexDialogBase); - buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); - buttonCancel->setAutoDefault(true); - - hboxLayout2->addWidget(buttonCancel); - - - vboxLayout->addLayout(hboxLayout2); - - retranslateUi(EditSysexDialogBase); - - QMetaObject::connectSlotsByName(EditSysexDialogBase); - } // setupUi - - void retranslateUi(QDialog *EditSysexDialogBase) - { - EditSysexDialogBase->setWindowTitle(QApplication::translate("EditSysexDialogBase", "MusE: Enter SysEx", 0, QApplication::UnicodeUTF8)); - textLabel1->setText(QApplication::translate("EditSysexDialogBase", "Known SysEx:", 0, QApplication::UnicodeUTF8)); - TextLabel1->setText(QApplication::translate("EditSysexDialogBase", "TimePosition:", 0, QApplication::UnicodeUTF8)); - TextLabel2->setText(QApplication::translate("EditSysexDialogBase", "Comment:", 0, QApplication::UnicodeUTF8)); - buttonAdd->setText(QApplication::translate("EditSysexDialogBase", "Add", 0, QApplication::UnicodeUTF8)); - buttonOk->setText(QApplication::translate("EditSysexDialogBase", "OK", 0, QApplication::UnicodeUTF8)); - buttonOk->setShortcut(QApplication::translate("EditSysexDialogBase", "", 0, QApplication::UnicodeUTF8)); - buttonCancel->setText(QApplication::translate("EditSysexDialogBase", "Cancel", 0, QApplication::UnicodeUTF8)); - buttonCancel->setShortcut(QApplication::translate("EditSysexDialogBase", "", 0, QApplication::UnicodeUTF8)); - Q_UNUSED(EditSysexDialogBase); - } // retranslateUi - -}; - -namespace Ui { - class EditSysexDialogBase: public Ui_EditSysexDialogBase {}; -} // namespace Ui - -class EditSysexDialogBase : public QDialog, public Ui::EditSysexDialogBase -{ - Q_OBJECT - -public: - EditSysexDialogBase(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0); - ~EditSysexDialogBase(); - -protected slots: - virtual void languageChange(); - -}; - -#endif // EDITSYSEXDIALOGBASE_H diff --git a/muse/muse/widgets/editsysexdialogbase.ui b/muse/muse/widgets/editsysexdialogbase.ui deleted file mode 100644 index 227d2b16..00000000 --- a/muse/muse/widgets/editsysexdialogbase.ui +++ /dev/null @@ -1,236 +0,0 @@ - - - - - EditSysexDialogBase - - - - 0 - 0 - 667 - 556 - - - - MusE: Enter SysEx - - - true - - - - 11 - - - 6 - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - - 4 - 5 - 0 - 0 - - - - Known SysEx: - - - - - - - - 4 - 7 - 0 - 0 - - - - - - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - TimePosition: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - - - - - Comment: - - - - - - - - - - - - - - 0 - - - 6 - - - - - - 1 - 0 - 0 - 0 - - - - Add - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 350 - 20 - - - - - - - - OK - - - - - - true - - - true - - - - - - - Cancel - - - - - - true - - - - - - - - - qPixmapFromMimeSource - - - Awl::PosEdit - QWidget -
awl::posedit.h
- 1 - -
- - Q3TextEdit - -
q3textedit.h
- 0 - -
- - Q3ListBox - -
q3listbox.h
- 0 - -
-
- - awl/posedit.h - - - -
diff --git a/muse/synti/deicsonze/deicsonze.cpp b/muse/synti/deicsonze/deicsonze.cpp index 05b388cd..db033da1 100644 --- a/muse/synti/deicsonze/deicsonze.cpp +++ b/muse/synti/deicsonze/deicsonze.cpp @@ -2111,12 +2111,12 @@ void DeicsOnze::writeConfiguration(AL::Xml* xml) { //xml->intTag(NBRVOICESSTR, (int)_global.nbrVoices); //xml->strTag(CHANNELNUMSTR, (_global.channelNum==-1?ALLSTR: // str.setNum(_global.channelNum+1))); - xml->tag(QUALITYSTR, (_global.quality==high?HIGHSTR: + xml->tag(QUALITYSTR, QString((_global.quality==high?HIGHSTR: (_global.quality==middle?MIDDLESTR: - (_global.quality==low?LOWSTR:ULTRALOWSTR)))); + (_global.quality==low?LOWSTR:ULTRALOWSTR))))); xml->tag(FONTSIZESTR, _global.fontSize); - xml->tag(SAVECONFIGSTR, (_saveConfig?YESSTRDEI:NOSTRDEI)); - xml->tag(SAVEONLYUSEDSTR, (_saveOnlyUsed?YESSTRDEI:NOSTRDEI)); + xml->tag(SAVECONFIGSTR, QString((_saveConfig?YESSTRDEI:NOSTRDEI))); + xml->tag(SAVEONLYUSEDSTR, QString((_saveOnlyUsed?YESSTRDEI:NOSTRDEI))); xml->tag(TEXTCOLORSTR, reinterpret_cast(*_gui->tColor)); xml->tag(BACKGROUNDCOLORSTR, @@ -2125,10 +2125,10 @@ void DeicsOnze::writeConfiguration(AL::Xml* xml) { reinterpret_cast(*_gui->etColor)); xml->tag(EDITBACKGROUNDCOLORSTR, reinterpret_cast(*_gui->ebColor)); - xml->tag(ISINITSETSTR, (_isInitSet?YESSTRDEI:NOSTRDEI)); - xml->tag(INITSETPATHSTR, _initSetPath.toAscii().data()); - xml->tag(ISBACKGROUNDPIXSTR, (_isBackgroundPix?YESSTRDEI:NOSTRDEI)); - xml->tag(BACKGROUNDPIXPATHSTR, _backgroundPixPath.toAscii().data()); + xml->tag(ISINITSETSTR, QString((_isInitSet?YESSTRDEI:NOSTRDEI))); + xml->tag(INITSETPATHSTR, QString(_initSetPath)); + xml->tag(ISBACKGROUNDPIXSTR, QString((_isBackgroundPix?YESSTRDEI:NOSTRDEI))); + xml->tag(BACKGROUNDPIXPATHSTR, _backgroundPixPath); xml->etag(DEICSONZECONFIGURATIONSTR); } diff --git a/muse/synti/deicsonze/deicsonzepreset.cpp b/muse/synti/deicsonze/deicsonzepreset.cpp index c6597000..7be54d78 100644 --- a/muse/synti/deicsonze/deicsonzepreset.cpp +++ b/muse/synti/deicsonze/deicsonzepreset.cpp @@ -554,7 +554,7 @@ void Set::readSet(QDomNode setNode) { //--------------------------------------------------------- void Set::writeSet(AL::Xml* xml, bool onlyUsed) { xml->stag("deicsOnzeSet version=\"1.0\""); - xml->tag("setName",_setName.c_str()); + xml->tag("setName", QString(_setName.c_str())); for(std::vector::iterator i=_categoryVector.begin(); i!=_categoryVector.end(); i++) (*i)->writeCategory(xml, onlyUsed); xml->etag("deicsOnzeSet"); @@ -590,7 +590,7 @@ void Category::readCategory(QDomNode catNode) { void Category::writeCategory(AL::Xml* xml, bool onlyUsed) { if((!onlyUsed || _isUsed)) { xml->stag("deicsOnzeCategory version=\"1.0\""); - xml->tag("categoryName",_categoryName.c_str()); + xml->tag("categoryName", QString(_categoryName.c_str())); xml->tag("hbank", _hbank); for(std::vector::iterator i=_subcategoryVector.begin(); i!=_subcategoryVector.end(); i++) @@ -629,7 +629,7 @@ void Subcategory::readSubcategory(QDomNode subNode) { void Subcategory::writeSubcategory(AL::Xml* xml, bool onlyUsed) { if((!onlyUsed || _isUsed)) { xml->stag("deicsOnzeSubcategory version=\"1.0\""); - xml->tag("subcategoryName",_subcategoryName.c_str()); + xml->tag("subcategoryName", QString(_subcategoryName.c_str())); xml->tag("lbank", _lbank); for(std::vector::iterator i=_presetVector.begin(); i!=_presetVector.end(); i++) (*i)->writePreset(xml, onlyUsed); @@ -911,14 +911,14 @@ void Preset::writePreset(AL::Xml* xml, bool onlyUsed) { xml->stag("deicsOnzePreset version=\"1.0\""); //algorithm - xml->tag(ALGSTR, (algorithm==FIRST? "FIRST": + xml->tag(ALGSTR, QString((algorithm==FIRST? "FIRST": (algorithm==SECOND? "SECOND": (algorithm==THIRD? "THIRD": (algorithm==FOURTH? "FOURTH": (algorithm==FIFTH? "FIFTH": (algorithm==SIXTH? "SIXTH": (algorithm==SEVENTH? "SEVENTH": - "EIGHTH")))))))); + "EIGHTH"))))))))); //feedback xml->tag(FEEDBACKSTR, feedback); //quick edit @@ -929,14 +929,14 @@ void Preset::writePreset(AL::Xml* xml, bool onlyUsed) { //xml->tag(RELEASESTR, release); //lfo xml->stag("lfo"); - xml->tag(WAVESTR, (lfo.wave==SAWUP? "SAWUP": + xml->tag(WAVESTR, QString((lfo.wave==SAWUP? "SAWUP": (lfo.wave==SQUARE? "SQUARE": - (lfo.wave==TRIANGL? "TRIANGL":"SHOLD")))); + (lfo.wave==TRIANGL? "TRIANGL":"SHOLD"))))); xml->tag(SPEEDSTR, lfo.speed); xml->tag(DELAYSTR, lfo.delay); xml->tag(PMODDEPTHSTR, lfo.pModDepth); xml->tag(AMODDEPTHSTR, lfo.aModDepth); - xml->tag(SYNCSTR, (lfo.sync==true? "on":"off")); + xml->tag(SYNCSTR, QString((lfo.sync==true? "on":"off"))); xml->etag("lfo"); //sensitivity xml->stag("sensitivity"); @@ -944,7 +944,7 @@ void Preset::writePreset(AL::Xml* xml, bool onlyUsed) { xml->tag(AMSSTR, sensitivity.amplitude); for(int i=0; itag(s, (sensitivity.ampOn[i]==true? "on":"off")); + xml->tag(s, QString((sensitivity.ampOn[i]==true? "on":"off"))); } for(int i=0; itag(s, (frequency[i].isFix==true? "yes":"no")); + xml->tag(s, QString((frequency[i].isFix==true? "yes":"no"))); } for(int i=0; itag(s, (oscWave[i]==W1?"W1": + xml->tag(s, QString((oscWave[i]==W1?"W1": (oscWave[i]==W2?"W2": (oscWave[i]==W3?"W3": (oscWave[i]==W4?"W4": (oscWave[i]==W5?"W5": (oscWave[i]==W6?"W6": - (oscWave[i]==W7?"W7":"W8")))))))); + (oscWave[i]==W7?"W7":"W8"))))))))); } //detune for(int i=0; itag(s, (eg[i].egShift==VOF?"VOF": + xml->tag(s, QString((eg[i].egShift==VOF?"VOF": (eg[i].egShift==V48?"V48": - (eg[i].egShift==V24?"V24":"V12")))); + (eg[i].egShift==V24?"V24":"V12"))))); } xml->etag("eg"); //pitchEg @@ -1043,12 +1043,12 @@ void Preset::writePreset(AL::Xml* xml, bool onlyUsed) { //function xml->stag("function"); xml->tag(TRANSPOSESTR, function.transpose); - xml->tag(POLYMODESTR, (function.mode==POLY? "POLY":"MONO")); + xml->tag(POLYMODESTR, QString((function.mode==POLY? "POLY":"MONO"))); xml->tag(PBENDRANGESTR, function.pBendRange); - xml->tag(PORTAMODESTR, (function.portamento==FINGER? - "FINGER":"FULL")); + xml->tag(PORTAMODESTR, QString((function.portamento==FINGER? + "FINGER":"FULL"))); xml->tag(PORTATIMESTR, function.portamentoTime); - xml->tag(FSWSTR, (function.footSw==POR? "POR":"SUS")); + xml->tag(FSWSTR, QString((function.footSw==POR? "POR":"SUS"))); xml->tag(FCVOLUMESTR, function.fcVolume); xml->tag(FCPITCHSTR, function.fcPitch); xml->tag(FCAMPLITUDESTR, function.fcAmplitude); @@ -1067,7 +1067,7 @@ void Preset::writePreset(AL::Xml* xml, bool onlyUsed) { //globalDetune //xml->tag("globalDetune", globalDetune); //preset name - xml->tag("name", name.c_str()); + xml->tag("name", QString(name.c_str())); //bank prog xml->tag("prog",prog); diff --git a/muse/synti/vam/vamgui.cpp b/muse/synti/vam/vamgui.cpp index 2787650d..c4d93672 100644 --- a/muse/synti/vam/vamgui.cpp +++ b/muse/synti/vam/vamgui.cpp @@ -8,7 +8,7 @@ // (Many) parts of this file was taken from Werner Schweer's GUI // for his organ soft synth. // -// (C) Copyright 2002 Jotsif Lindman Hönlund (jotsif@linux.nu) +// (C) Copyright 2002 Jotsif Lindman Hölund (jotsif@linux.nu) // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -140,9 +140,9 @@ void Preset::readConfiguration(QDomNode /*node*/) void Preset::writeConfiguration(Xml& xml) { - xml.stag("preset name=\"%s\"", name.toLatin1().data()); + xml.stag(QString("preset name=\"%1\"").arg(name)); for (int i = 0; i < NUM_CONTROLLER; ++i) { - xml.tagE("control idx=\"%d\" val=\"%d\"", i, ctrl[i]); + xml.tagE(QString("control idx=\"%1\" val=\"%2\"").arg(i).arg(ctrl[i])); } xml.etag("preset"); } -- cgit v1.2.3