From fa0f6a249c806cb9c58e14d68489ef7fa6b39989 Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Wed, 29 Nov 2006 15:08:06 +0000 Subject: more fixes --- muse/awl/tcanvas.cpp | 67 +++++++++++++++++++-------------------- muse/awl/tcanvas.h | 3 +- muse/muse/arranger/canvas.cpp | 2 +- muse/muse/arranger/partdrag.cpp | 30 +++++++++++++++--- muse/muse/exportmidi.cpp | 31 +++++++++--------- muse/muse/midiedit/midieditor.cpp | 58 ++++++++++++++------------------- muse/muse/midiedit/midieditor.h | 1 - muse/muse/midiedit/prcanvas.cpp | 4 +-- muse/muse/mixer/mstrip.cpp | 6 ++++ muse/muse/shortcuts.cpp | 4 +-- muse/muse/wave.cpp | 1 + muse/muse/waveedit/waveedit.cpp | 55 +++++++++++++++++++------------- muse/muse/waveedit/waveedit.h | 21 +++++++++--- muse/muse/waveedit/waveview.cpp | 25 +++++++++++---- muse/muse/waveedit/waveview.h | 23 +++++++++++--- muse/muse/wavetrack.cpp | 5 ++- 16 files changed, 200 insertions(+), 136 deletions(-) diff --git a/muse/awl/tcanvas.cpp b/muse/awl/tcanvas.cpp index 18b63ce0..286c5837 100644 --- a/muse/awl/tcanvas.cpp +++ b/muse/awl/tcanvas.cpp @@ -81,14 +81,7 @@ TimeCanvas::TimeCanvas(TimeCanvasType t) setLayout(grid); _widget = new QWidget; -// _widget->setAttribute(Qt::WA_OpaquePaintEvent); _widget->setAttribute(Qt::WA_NoSystemBackground); - - // there are some performance problems with qt4.1, so - // we roll our own double buffering: - - _widget->setAttribute(Qt::WA_PaintOnScreen); - _widget->setAttribute(Qt::WA_StaticContents); _widget->installEventFilter(this); _widget->setMouseTracking(true); @@ -123,23 +116,26 @@ TimeCanvas::TimeCanvas(TimeCanvasType t) setTimeType1(AL::TICKS); yRange = 0; - if (type == TIME_CANVAS_PIANOROLL) { - _ymagMin = 0.5; - _ymagMax = 3.0; - vmag->setValue(lrint((_ymag-_ymagMin)*100.0/(_ymagMax-_ymagMin))); - initPianoroll(); - } - else if (type == TIME_CANVAS_DRUMEDIT) { - _ymagMin = 1.0; - _ymagMax = 1.0; - yRange = drumHeight * 128; - } - else if (type == TIME_CANVAS) { - _ymagMin = 1.0; - _ymagMax = 1.0; + switch(type) { + case TIME_CANVAS_PIANOROLL: + _ymagMin = 0.5; + _ymagMax = 3.0; + vmag->setValue(lrint((_ymag-_ymagMin)*100.0/(_ymagMax-_ymagMin))); + initPianoroll(); + break; + case TIME_CANVAS_DRUMEDIT: + _ymagMin = 1.0; + _ymagMax = 1.0; + yRange = drumHeight * 128; + break; + default: + _ymagMin = 1.0; + _ymagMax = 1.0; + break; } updateGeometry(); - if (type == TIME_CANVAS_PIANOROLL || type == TIME_CANVAS_DRUMEDIT) { + if (type == TIME_CANVAS_PIANOROLL || type == TIME_CANVAS_DRUMEDIT + || type == TIME_CANVAS_WAVEEDIT) { addCtrlButton = new QPushButton(tr("Ctrl"), _widget); addCtrlButton->setGeometry(1, 1, rPanelA.width()-4, rulerHeight-4); addCtrlButton->setToolTip(tr("Add Controller View")); @@ -159,7 +155,6 @@ TimeCanvas::TimeCanvas(TimeCanvasType t) _raster = 0; updateScrollBars(); - //connect(hbar, SIGNAL(sliderMoved(int)), SLOT(moveX(int))); connect(hbar, SIGNAL(valueChanged(int)), SLOT(moveX(int))); connect(vbar, SIGNAL(valueChanged(int)), SLOT(moveY(int))); connect(hmag, SIGNAL(valueChanged(int)), SLOT(scaleX(int))); @@ -194,15 +189,11 @@ bool TimeCanvas::eventFilter(QObject* obj, QEvent* event) switch(event->type()) { case QEvent::Paint: - { - QRect r(((QPaintEvent*)event)->rect()); - -// if (r == _widget->geometry()) -// printf("full paint event\n"); - QPainter p(_widget); - canvasPaintEvent(r, p); - } - return true; + { + QPainter p(_widget); + canvasPaintEvent(((QPaintEvent*)event)->rect(), p); + } + return true; case QEvent::Resize: updateGeometry(); @@ -373,7 +364,7 @@ bool TimeCanvas::eventFilter(QObject* obj, QEvent* event) // // xmag // - int oldx = e->x(); + int oldx = e->x() - rCanvasA.x(); AL::Pos pos(pix2pos(oldx)); int step = e->delta() / 120; if (step > 0) { @@ -384,6 +375,10 @@ bool TimeCanvas::eventFilter(QObject* obj, QEvent* event) for (int i = 0; i < -step; ++i) _xmag *= 0.9; } + if (_xmag < _xmagMin) + _xmag = _xmagMin; + else if (_xmag > _xmagMax) + _xmag = _xmagMax; hmag->setValue(xmag2s(_xmag)); updateScrollBars(); updateRulerMag(); @@ -719,7 +714,8 @@ void TimeCanvas::paintMetronomRuler(QPainter& p, const QRect& r) QRect r = QRect(x+2, y, 1000, h); p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter, s); p.setPen(Qt::lightGray); - p.drawLine(x, y1, x, y2); + if (x > 0) + p.drawLine(x, y1, x, y2); } else { AL::TimeSignature sig = stick.timesig(); @@ -749,7 +745,8 @@ void TimeCanvas::paintMetronomRuler(QPainter& p, const QRect& r) p.drawLine(xp, y3, xp, y+h); p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter, s); p.setPen(beat == 0 ? Qt::lightGray : Qt::gray); - p.drawLine(xp, y1, xp, y2); + if (xp > 0) + p.drawLine(xp, y1, xp, y2); } } if (bar == 0 && n >= 2) diff --git a/muse/awl/tcanvas.h b/muse/awl/tcanvas.h index 2cf4b3fc..a2955a07 100644 --- a/muse/awl/tcanvas.h +++ b/muse/awl/tcanvas.h @@ -27,7 +27,8 @@ #define MAP_OFFSET 20 enum TimeCanvasType { - TIME_CANVAS, TIME_CANVAS_PIANOROLL, TIME_CANVAS_DRUMEDIT + TIME_CANVAS, TIME_CANVAS_PIANOROLL, TIME_CANVAS_DRUMEDIT, + TIME_CANVAS_WAVEEDIT }; enum Tool { diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp index f0058d60..4dbd068e 100644 --- a/muse/muse/arranger/canvas.cpp +++ b/muse/muse/arranger/canvas.cpp @@ -687,7 +687,7 @@ void PartCanvas::mouseMove(QPoint pos) } if (!track) return; - int y = track->arrangerTrack.tw->y() - splitWidth/2; + int y = track->arrangerTrack.tw->y(); // - splitWidth/2; int ph = track->arrangerTrack.tw->height() - 1 - partBorderWidth; if (state == S_DRAG1) { // diff --git a/muse/muse/arranger/partdrag.cpp b/muse/muse/arranger/partdrag.cpp index e497b613..9c77d6bc 100644 --- a/muse/muse/arranger/partdrag.cpp +++ b/muse/muse/arranger/partdrag.cpp @@ -124,11 +124,31 @@ bool AudioPartDrag::canDecode(const QMimeData* s) bool AudioPartDrag::decode(const QMimeData* s, Part*& p) { - QByteArray a = s->data(type); - char* cp = (char*)(&p); - for (unsigned i = 0; i < sizeof(p); ++i) - *cp++ = a[i]; - return true; + p = 0; + QDomDocument doc; + int line, column; + QString err; + if (!doc.setContent(s->data(type), false, &err, &line, &column)) { + QString col, ln, error; + col.setNum(column); + ln.setNum(line); + error = err + "\n at line: " + ln + " col: " + col; + printf("error parsing part: %s\n", error.toLatin1().data()); + return false; + } + for (QDomNode node = doc.documentElement(); !node.isNull(); node = node.nextSibling()) { + QDomElement e = node.toElement(); + if (e.isNull()) + continue; + if (e.tagName() == "part") { + p = new Part(0); + p->ref(); + p->read(node, false); + } + else + printf("MusE: %s not supported\n", e.tagName().toLatin1().data()); + } + return (p != 0); } //--------------------------------------------------------- diff --git a/muse/muse/exportmidi.cpp b/muse/muse/exportmidi.cpp index 6f071b9d..f18794ab 100644 --- a/muse/muse/exportmidi.cpp +++ b/muse/muse/exportmidi.cpp @@ -39,7 +39,7 @@ // addController //--------------------------------------------------------- -static void addController(MidiEventList* l, int tick, int /*port*/, int channel, int a, int b) +static void addController(MidiEventList* l, int tick, int channel, int a, int b) { if (a < 0x1000) { // 7 Bit Controller l->insert(MidiEvent(tick, channel, ME_CONTROLLER, a, b)); @@ -146,10 +146,21 @@ void MusE::exportMidi() mtl->push_back(mft); MidiEventList* l = &(mft->events); - int port = 0; // track->channel()->port(); int channel = 0; channel = track->channelNo(); + //----------------------------------- + // track name + //----------------------------------- + + if (!track->name().isEmpty()) { + const char* name = track->name().toAscii().data(); + int len = strlen(name); + MidiEvent ev(0, ME_META, (unsigned char*)name, len+1); + ev.setA(0x3); // Meta Sequence/Track Name + l->insert(ev); + } + //----------------------------------- // managed controller //----------------------------------- @@ -161,22 +172,10 @@ void MusE::exportMidi() for (iCtrlVal iv = c->begin(); iv != c->end(); ++iv) { int tick = iv.key(); int val = iv.value().i; - addController(l, tick, port, channel, id, val); + addController(l, tick, channel, id, val); } } - //----------------------------------- - // track name - //----------------------------------- - - if (!track->name().isEmpty()) { - const char* name = track->name().toAscii().data(); - int len = strlen(name); - MidiEvent ev(0, ME_META, (unsigned char*)name, len+1); - ev.setA(0x3); // Meta Sequence/Track Name - l->insert(ev); - } - //----------------------------------- // track comment //----------------------------------- @@ -237,7 +236,7 @@ void MusE::exportMidi() break; case Controller: - addController(l, tick, port, channel, ev.dataA(), ev.dataB()); + addController(l, tick, channel, ev.dataA(), ev.dataB()); break; case Sysex: diff --git a/muse/muse/midiedit/midieditor.cpp b/muse/muse/midiedit/midieditor.cpp index 8dfe4d5a..4b7fd60b 100644 --- a/muse/muse/midiedit/midieditor.cpp +++ b/muse/muse/midiedit/midieditor.cpp @@ -25,6 +25,7 @@ #include "ecanvas.h" #include "icons.h" #include "audio.h" +#include "shortcuts.h" //--------------------------------------------------------- // MidiEditor @@ -50,20 +51,12 @@ MidiEditor::MidiEditor(PartList* pl) menuEdit->addAction(redoAction); menuEdit->addSeparator(); - cutAction = menuEdit->addAction(tr("Cut")); - cutAction->setIcon(*editcutIconSet); - cutAction->setData(MidiEditor::CMD_CUT); - cutAction->setShortcut(Qt::CTRL+Qt::Key_X); - - copyAction = menuEdit->addAction(tr("Copy")); - copyAction->setIcon(*editcopyIconSet); - copyAction->setData(MidiEditor::CMD_COPY); - copyAction->setShortcut(Qt::CTRL+Qt::Key_C); - - pasteAction = menuEdit->addAction(tr("Paste")); - pasteAction->setIcon(*editpasteIconSet); - pasteAction->setData(MidiEditor::CMD_PASTE); - pasteAction->setShortcut(Qt::CTRL+Qt::Key_V); + cutAction = getAction("cut", this); + menuEdit->addAction(cutAction); + copyAction = getAction("copy", this); + menuEdit->addAction(copyAction); + pasteAction = getAction("paste", this); + menuEdit->addAction(pasteAction); speaker = new QAction(this); speaker->setCheckable(true); @@ -102,29 +95,24 @@ MidiEditor::MidiEditor(PartList* pl) void MidiEditor::midiCmd(QAction* a) { - switch (a->data().toInt()) { - case CMD_CUT: - { - copy(); - song->startUndo(); - CItemList* items = canvas()->getItems(); - for (iCItem i = items->begin(); i != items->end(); ++i) { - if (!i->second->isSelected()) - continue; - CItem* e = i->second; - Event event = e->event; - audio->msgDeleteEvent(event, e->part, false); - } - song->endUndo(SC_EVENT_REMOVED); + QString s(a->data().toString()); + if (s == "cut") { + copy(); + song->startUndo(); + CItemList* items = canvas()->getItems(); + for (iCItem i = items->begin(); i != items->end(); ++i) { + if (!i->second->isSelected()) + continue; + CItem* e = i->second; + Event event = e->event; + audio->msgDeleteEvent(event, e->part, false); } - break; - case CMD_COPY: - copy(); - break; - default: - cmd(a); - break; + song->endUndo(SC_EVENT_REMOVED); } + else if (s == "copy") + copy(); + else + cmd(a); } //--------------------------------------------------------- diff --git a/muse/muse/midiedit/midieditor.h b/muse/muse/midiedit/midieditor.h index cf66ddbc..d35eee6c 100644 --- a/muse/muse/midiedit/midieditor.h +++ b/muse/muse/midiedit/midieditor.h @@ -76,7 +76,6 @@ class MidiEditor : public Editor { QAction* stepRecAction; QAction* midiInAction; QAction* followSongAction; - QAction* cutAction; QAction* copyAction; QAction* pasteAction; diff --git a/muse/muse/midiedit/prcanvas.cpp b/muse/muse/midiedit/prcanvas.cpp index e0403120..96a5d9ba 100644 --- a/muse/muse/midiedit/prcanvas.cpp +++ b/muse/muse/midiedit/prcanvas.cpp @@ -203,7 +203,7 @@ void PianoCanvas::moveItem(CItem* item, DragType dtype) { Part* part = item->part; Event event = item->event; - int npitch = y2pitch(item->my - wpos.y() + item->bbox.height()/2); + int npitch = y2pitch(item->my -wpos.y() + item->bbox.height()/2); if (event.pitch() != npitch && editor->playEvents()) { // release note: MidiEvent ev1(0, 0, 0x90, event.pitch() + track()->transposition(), 0); @@ -618,7 +618,7 @@ void PianoCanvas::itemReleased() void PianoCanvas::itemMoved(const CItem* item) { - int npitch = y2pitch(item->my + wpos.y()); + int npitch = y2pitch(item->my - wpos.y()); if ((playedPitch != -1) && (playedPitch != npitch)) { Event event = item->event; // release note: diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp index 2e336d21..7b67498f 100644 --- a/muse/muse/mixer/mstrip.cpp +++ b/muse/muse/mixer/mstrip.cpp @@ -317,6 +317,11 @@ MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align) connect(track, SIGNAL(autoWriteChanged(bool)), SLOT(autoChanged())); connect(track, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int))); autoChanged(); + controllerChanged(CTRL_VOLUME); + controllerChanged(CTRL_PANPOT); + controllerChanged(CTRL_VARIATION_SEND); + controllerChanged(CTRL_REVERB_SEND); + controllerChanged(CTRL_CHORUS_SEND); } //--------------------------------------------------------- @@ -636,6 +641,7 @@ MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align) connect(track, SIGNAL(autoReadChanged(bool)), SLOT(autoChanged())); connect(track, SIGNAL(autoWriteChanged(bool)), SLOT(autoChanged())); autoChanged(); + controllerChanged(CTRL_MASTER_VOLUME); } //--------------------------------------------------------- diff --git a/muse/muse/shortcuts.cpp b/muse/muse/shortcuts.cpp index c0f31008..dd9bdae9 100644 --- a/muse/muse/shortcuts.cpp +++ b/muse/muse/shortcuts.cpp @@ -1045,8 +1045,8 @@ QAction* getAction(const char* id, QObject* parent) s->action->setIcon(icon); } } - else - printf("action <%s> already initialized\n", s->xml); +// else +// printf("action <%s> already initialized\n", s->xml); return s->action; } diff --git a/muse/muse/wave.cpp b/muse/muse/wave.cpp index 934b8b9d..f0e360c7 100644 --- a/muse/muse/wave.cpp +++ b/muse/muse/wave.cpp @@ -898,6 +898,7 @@ bool MusE::importWaveToTrack(const QString& wave, Track* track, const Pos& pos) track->setChannels(f->channels()); Part* part = new Part((WaveTrack *)track); + part->ref(); part->setType(AL::FRAMES); part->setTick(pos.tick()); part->setLenFrame(samples); diff --git a/muse/muse/waveedit/waveedit.cpp b/muse/muse/waveedit/waveedit.cpp index d285bf8f..bbea7e82 100644 --- a/muse/muse/waveedit/waveedit.cpp +++ b/muse/muse/waveedit/waveedit.cpp @@ -1,9 +1,23 @@ -//========================================================= +//============================================================================= // MusE // Linux Music Editor -// $Id: waveedit.cpp,v 1.33 2006/02/10 16:40:59 wschweer Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= +// $Id:$ +// +// Copyright (C) 2000-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + #include "waveedit.h" #include "waveview.h" @@ -38,38 +52,35 @@ WaveEdit::WaveEdit(PartList* pl, bool init) menuGain = menuFunctions->addMenu(tr("&Gain")); a = menuGain->addAction(tr("200%")); - a->setData(CMD_GAIN_200); + a->setData("gain200"); a = menuGain->addAction(tr("150%")); - a->setData(CMD_GAIN_150); + a->setData("gain150"); a = menuGain->addAction(tr("75%")); - a->setData(CMD_GAIN_75); + a->setData("gain75"); a = menuGain->addAction(tr("50%")); - a->setData(CMD_GAIN_50); + a->setData("gain50"); a = menuGain->addAction(tr("25%")); - a->setData(CMD_GAIN_25); + a->setData("gain25"); a = menuGain->addAction(tr("Other")); - a->setData(CMD_GAIN_FREE); + a->setData("gain_free"); a = menuFunctions->addSeparator(); a = menuEdit->addAction(tr("Edit in E&xternal Editor")); - a->setData(CMD_EDIT_EXTERNAL); + a->setData("exit_external"); a = menuFunctions->addAction(tr("Mute Selection")); - a->setData(CMD_MUTE); + a->setData("mute"); a = menuFunctions->addAction(tr("Normalize Selection")); - a->setData(CMD_NORMALIZE); + a->setData("normalize"); a = menuFunctions->addAction(tr("Fade In Selection")); - a->setData(CMD_FADE_IN); + a->setData("fade_in"); a = menuFunctions->addAction(tr("Fade Out Selection")); - a->setData(CMD_FADE_OUT); + a->setData("fade_out"); a = menuFunctions->addAction(tr("Reverse Selection")); - a->setData(CMD_REVERSE); + a->setData("reverse"); select = menuEdit->addMenu(QIcon(*selectIcon), tr("Select")); - a = select->addAction(QIcon(":/xpm/select_all.xpm"), tr("Select &All")); - a->setData(CMD_SELECT_ALL); - a = select->addAction(QIcon(":/xpm/select_deselect_all.xpm"), tr("&Deselect All")); - a->setData(CMD_SELECT_NONE); - + select->addAction(getAction("sel_all", this)); + select->addAction(getAction("sel_none", this)); connect(menuFunctions, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); connect(menuFile, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); @@ -183,7 +194,7 @@ WaveEdit::~WaveEdit() void WaveEdit::cmd(QAction* a) { - view->cmd(a->data().toInt()); + view->cmd(a->data().toString()); } //--------------------------------------------------------- diff --git a/muse/muse/waveedit/waveedit.h b/muse/muse/waveedit/waveedit.h index 073f5eee..bd98a6b7 100644 --- a/muse/muse/waveedit/waveedit.h +++ b/muse/muse/waveedit/waveedit.h @@ -1,9 +1,22 @@ -//========================================================= +//============================================================================= // MusE // Linux Music Editor -// $Id: waveedit.h,v 1.19 2006/02/01 22:44:40 wschweer Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= #ifndef __WAVE_EDIT_H__ #define __WAVE_EDIT_H__ diff --git a/muse/muse/waveedit/waveview.cpp b/muse/muse/waveedit/waveview.cpp index f1352f6d..82c5ed32 100644 --- a/muse/muse/waveedit/waveview.cpp +++ b/muse/muse/waveedit/waveview.cpp @@ -1,9 +1,22 @@ -//========================================================= +//============================================================================= // MusE // Linux Music Editor -// $Id: waveview.cpp,v 1.25 2006/02/01 22:44:40 wschweer Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= #include @@ -23,7 +36,7 @@ //--------------------------------------------------------- WaveView::WaveView(WaveEdit* pr) - : TimeCanvas(TIME_CANVAS) + : TimeCanvas(TIME_CANVAS_WAVEEDIT) { selectionStart = 0; selectionStop = 0; @@ -328,7 +341,7 @@ void WaveView::viewMouseMoveEvent(QMouseEvent* /*event*/) // cmd //--------------------------------------------------------- -void WaveView::cmd(int /*n*/) +void WaveView::cmd(const QString& c) { #if 0 int modifyoperation = -1; diff --git a/muse/muse/waveedit/waveview.h b/muse/muse/waveedit/waveview.h index bf63dffb..6e4ad747 100644 --- a/muse/muse/waveedit/waveview.h +++ b/muse/muse/waveedit/waveview.h @@ -1,9 +1,22 @@ -//========================================================= +//============================================================================= // MusE // Linux Music Editor -// $Id: waveview.h,v 1.11 2006/02/01 22:44:40 wschweer Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= #ifndef WAVE_VIEW_H #define WAVE_VIEW_H @@ -82,7 +95,7 @@ class WaveView : public TimeCanvas { public: WaveView(WaveEdit*); QString getCaption() const; - void cmd(int n); + void cmd(const QString&); void range(AL::Pos&, AL::Pos&) const; }; diff --git a/muse/muse/wavetrack.cpp b/muse/muse/wavetrack.cpp index 750c805a..9b7787a5 100644 --- a/muse/muse/wavetrack.cpp +++ b/muse/muse/wavetrack.cpp @@ -156,7 +156,6 @@ void WaveTrack::read(QDomNode node) QDomElement e = node.toElement(); if (e.tagName() == "part") { Part* p = newPart(); - p->ref(); p->read(node, false); parts()->add(p); } @@ -175,12 +174,16 @@ Part* WaveTrack::newPart(Part*p, bool clone) if (p) { if (clone) part->clone(p->events()); + else + part->ref(); part->setName(p->name()); part->setColorIndex(p->colorIndex()); *(AL::PosLen*)part = *(AL::PosLen*)p; part->setMute(p->mute()); } + else + part->ref(); return part; } -- cgit v1.2.3