diff options
author | Werner Schweer <ws.seh.de> | 2006-12-03 21:35:25 +0000 |
---|---|---|
committer | Werner Schweer <ws.seh.de> | 2006-12-03 21:35:25 +0000 |
commit | b4c69ef0a05e2f217bd76e5bebe61cea41689ba1 (patch) | |
tree | 82fff1af5eca92f8396124534a1be0daaa224c87 | |
parent | 5c403bd6717ccf8e88ac262139b23eff0447aca1 (diff) |
updates
-rw-r--r-- | muse/muse/arranger/canvas.cpp | 88 | ||||
-rw-r--r-- | muse/muse/arranger/tlwidget.cpp | 4 | ||||
-rw-r--r-- | muse/muse/ctrl/definemidictrl.cpp | 44 | ||||
-rw-r--r-- | muse/muse/ctrl/definemidictrl.h | 47 | ||||
-rw-r--r-- | muse/muse/mixer/astrip.cpp | 1 | ||||
-rw-r--r-- | muse/muse/mixer/mstrip.cpp | 17 | ||||
-rw-r--r-- | muse/muse/song.h | 2 | ||||
-rw-r--r-- | muse/muse/songtrack.cpp | 18 |
8 files changed, 182 insertions, 39 deletions
diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp index 4dbd068e..5ea2efed 100644 --- a/muse/muse/arranger/canvas.cpp +++ b/muse/muse/arranger/canvas.cpp @@ -928,23 +928,41 @@ void PartCanvas::copyPart(Part* part) void PartCanvas::dragEnter(QDragEnterEvent* event) { +#if 0 + QPoint p(event->pos() - rCanvasA.topLeft()); + searchPart(p); + if (!track) { + event->ignore(); + return; + } + int srcIsMidi = -1; const QMimeData* md = event->mimeData(); - if (MidiPartDrag::canDecode(md) - || AudioPartDrag::canDecode(md) - || WavUriDrag::canDecode(md)) { - Qt::KeyboardModifiers kb = event->keyboardModifiers(); - if (kb == 0 && (Qt::MoveAction & event->possibleActions())) { - event->setDropAction(Qt::MoveAction); - event->accept(); - } - else - event->acceptProposedAction(); + + if (MidiPartDrag::canDecode(md)) + srcIsMidi = 1; + else if (AudioPartDrag::canDecode(md)) + srcIsMidi = 0; + else if (WavUriDrag::canDecode(md)) + srcIsMidi = 0; + + int dstIsMidi = -1; + if (track->type() == Track::MIDI) + dstIsMidi = 1; + else if (track->type() == Track::WAVE) + dstIsMidi = 0; + + if ((srcIsMidi == -1) || (dstIsMidi != srcIsMidi)) { + event->ignore(); + return; } - else { - QStringList formats = md->formats(); - foreach(QString s, formats) - printf("drag format <%s>\n", s.toLatin1().data()); + Qt::KeyboardModifiers kb = event->keyboardModifiers(); + if (kb == 0 && (Qt::MoveAction & event->possibleActions())) { + event->setDropAction(Qt::MoveAction); + event->accept(); } + else +#endif + event->acceptProposedAction(); } //--------------------------------------------------------- @@ -956,14 +974,9 @@ void PartCanvas::dragMove(QDragMoveEvent* event) QPoint p(event->pos() - rCanvasA.topLeft()); searchPart(p); if (!track) { - if (state != S_NORMAL) { - state = S_NORMAL; - widget()->update(); - } - event->ignore(); + event->acceptProposedAction(); return; } - Part* srcPart = 0; QString filename; @@ -995,8 +1008,12 @@ void PartCanvas::dragMove(QDragMoveEvent* event) return; } - bool dstIsMidi = track->type() == Track::MIDI; - if (dstIsMidi != srcIsMidi) { + int dstIsMidi = -1; + if (track->type() == Track::MIDI) + dstIsMidi = 1; + else if (track->type() == Track::WAVE) + dstIsMidi = 0; + if ((srcIsMidi == -1) || (dstIsMidi != srcIsMidi)) { if (state != S_NORMAL) { state = S_NORMAL; widget()->update(); @@ -1064,11 +1081,28 @@ void PartCanvas::drop(QDropEvent* event) AudioPartDrag::decode(md, dstPart); searchPart(pos); - if (!track || !dstPart || isMidi != track->isMidiTrack()) + if (!dstPart) + return; + PartCanvas* cw = (PartCanvas*)event->source(); + bool needEndUndo = false; + if (!track) { + if (isMidi) + track = new MidiTrack(); + else + track = new WaveTrack(); + track->setDefaultName(); + if (cw) + song->insertTrack(track, -1); + else { + song->startUndo(); + song->insertTrack(track, -1); + needEndUndo = true; + } + } + else if (isMidi != track->isMidiTrack()) return; dstPart->setTrack(track); - PartCanvas* cw = (PartCanvas*)event->source(); // // cw == 0 means that we are dropping to @@ -1087,7 +1121,7 @@ void PartCanvas::drop(QDropEvent* event) if (kb == 0 && (Qt::MoveAction & event->possibleActions())) da = Qt::MoveAction; - if ((da == Qt::LinkAction) && (event->source() == this)) { + if ((da == Qt::LinkAction) && (cw == this)) { delete dstPart->events(); dstPart->clone(srcPart->events()); event->setDropAction(Qt::LinkAction); @@ -1097,10 +1131,12 @@ void PartCanvas::drop(QDropEvent* event) else event->setDropAction(Qt::CopyAction); event->accept(); - if (cw) + if (cw || needEndUndo) song->addPart(dstPart); else song->cmdAddPart(dstPart); + if (needEndUndo) + song->endUndo(0); widget()->update(); } diff --git a/muse/muse/arranger/tlwidget.cpp b/muse/muse/arranger/tlwidget.cpp index ec6cb9e3..6608a2c2 100644 --- a/muse/muse/arranger/tlwidget.cpp +++ b/muse/muse/arranger/tlwidget.cpp @@ -165,12 +165,12 @@ void TLWidget::mousePressEvent(QMouseEvent* ev) if (_track->type() == Track::MIDI) { MidiTrack* t = new MidiTrack(); t->clone((MidiTrack*)_track); - song->insertTrack(t, idx); + song->cmdInsertTrack(t, idx); } else { WaveTrack* t = new WaveTrack(); t->clone((WaveTrack*)_track); - song->insertTrack(t, idx); + song->cmdInsertTrack(t, idx); } } break; diff --git a/muse/muse/ctrl/definemidictrl.cpp b/muse/muse/ctrl/definemidictrl.cpp new file mode 100644 index 00000000..3b46f2d5 --- /dev/null +++ b/muse/muse/ctrl/definemidictrl.cpp @@ -0,0 +1,44 @@ +//============================================================================= +// MusE +// Linux Music Editor +// $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 "definemidictrl.h" +#include "miditrack.h" + +//--------------------------------------------------------- +// DefineMidiCtrlDialog +//--------------------------------------------------------- + +DefineMidiCtrl::DefineMidiCtrl(MidiTrack* t, QWidget* parent) + : QDialog(parent) + { + setupUi(this); + track = t; + } + +//--------------------------------------------------------- +// done +// val == 1 -> OK +//--------------------------------------------------------- + +void DefineMidiCtrl::done(int val) + { + QDialog::done(val); + } + diff --git a/muse/muse/ctrl/definemidictrl.h b/muse/muse/ctrl/definemidictrl.h new file mode 100644 index 00000000..c498c81c --- /dev/null +++ b/muse/muse/ctrl/definemidictrl.h @@ -0,0 +1,47 @@ +//============================================================================= +// MusE +// Linux Music Editor +// $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 __DEFINEMIDICTRL_H__ +#define __DEFINEMIDICTRL_H__ + +#include "ui_definemidictrl.h" + +class MidiTrack; + +//--------------------------------------------------------- +// DefineMidiCtrl +//--------------------------------------------------------- + +class DefineMidiCtrl : public QDialog, public Ui::DefineMidiCtrlBase { + Q_OBJECT + + MidiTrack* track; + + private slots: + virtual void done(int); + + public: + DefineMidiCtrl(MidiTrack* t, QWidget* parent = 0); + }; + +#endif + + + diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp index dc75b6e7..32ab4a3e 100644 --- a/muse/muse/mixer/astrip.cpp +++ b/muse/muse/mixer/astrip.cpp @@ -106,6 +106,7 @@ AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align) sl->setSuffix(tr("dB")); sl->setFrame(true); sl->setValue(vol); + sl->setFixedHeight(entrySize.height()); connect(slider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double))); connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double))); diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp index 7b67498f..829877e1 100644 --- a/muse/muse/mixer/mstrip.cpp +++ b/muse/muse/mixer/mstrip.cpp @@ -171,11 +171,12 @@ void MidiStrip::addKnob(int ctrl, int idx, const QString& tt, const QString& lab knob = new Awl::Knob(this); knob->setRange(0.0, 127.0); } + knob->setFixedSize(buttonSize.width(), entrySize.height() * 2); knob->setId(ctrl); dl->setId(ctrl); + dl->setFrame(true); controller[idx].knob = knob; - knob->setFixedSize(buttonSize.width(), entrySize.height() * 2); knob->setToolTip(tt); knob->setEnabled(enabled); @@ -234,6 +235,7 @@ MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align) sl = new Awl::MidiVolEntry(this); sl->setId(CTRL_VOLUME); sl->setFont(config.fonts[1]); + sl->setFixedHeight(entrySize.height()); connect(slider, SIGNAL(valueChanged(double,int)), SLOT(ctrlChanged(double, int))); connect(slider, SIGNAL(sliderPressed(int)), SLOT(sliderPressed(int))); @@ -541,10 +543,11 @@ MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align) //--------------------------------------------------- MidiRack* rack = new MidiRack(this, t); - rack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - rack->setFixedSize(STRIP_WIDTH, rack->sizeHint().height()+2); + rack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + rack->setFixedHeight(rack->sizeHint().height()+2); layout->addWidget(rack); + if (_align) layout->addSpacing(STRIP_WIDTH/2); @@ -564,6 +567,7 @@ MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align) sl->setId(CTRL_MASTER_VOLUME); sl->setMax(128 * 128 - 1); sl->setFont(config.fonts[1]); + sl->setFixedHeight(entrySize.height()); controllerChanged(CTRL_MASTER_VOLUME); @@ -846,8 +850,8 @@ MidiInPortStrip::MidiInPortStrip(Mixer* m, MidiInPort* t, bool align) //--------------------------------------------------- MidiRack* rack = new MidiRack(this, t); - rack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - rack->setFixedSize(STRIP_WIDTH, rack->sizeHint().height()+2); + rack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + rack->setFixedHeight(rack->sizeHint().height()+2); layout->addWidget(rack); //--------------------------------------------------- @@ -1063,7 +1067,8 @@ MidiSyntiStrip::MidiSyntiStrip(Mixer* m, MidiSynti* t, bool align) sl = new Awl::MidiVolEntry(this); sl->setId(CTRL_MASTER_VOLUME); sl->setFont(config.fonts[1]); - sl->setFixedWidth(STRIP_WIDTH-2); +// sl->setFixedWidth(STRIP_WIDTH-2); + sl->setFixedHeight(entrySize.height()); connect(slider, SIGNAL(valueChanged(double,int)), SLOT(ctrlChanged(double, int))); connect(slider, SIGNAL(sliderPressed(int)), SLOT(sliderPressed(int))); diff --git a/muse/muse/song.h b/muse/muse/song.h index 895ff3ee..ac2c3c60 100644 --- a/muse/muse/song.h +++ b/muse/muse/song.h @@ -326,7 +326,9 @@ class Song : public QObject { void swapTracks(int i1, int i2); void moveTrack(Track*, Track*); + void cmdInsertTrack(Track*, int idx); void insertTrack(Track*, int idx); + void insertTrack0(Track*, int idx); void insertTrack1(Track*, int idx); void insertTrack2(Track*); diff --git a/muse/muse/songtrack.cpp b/muse/muse/songtrack.cpp index bc910222..ff54d3af 100644 --- a/muse/muse/songtrack.cpp +++ b/muse/muse/songtrack.cpp @@ -191,11 +191,23 @@ Track* Song::addTrack(QAction* action) return 0; } track->setDefaultName(); - insertTrack(track, -1); + cmdInsertTrack(track, -1); return track; } //--------------------------------------------------------- +// cmdInsertTrack +//--------------------------------------------------------- + +void Song::cmdInsertTrack(Track* track, int idx) + { + startUndo(); + insertTrack(track, idx); + endUndo(SC_TRACK_INSERTED | SC_ROUTE); + selectTrack(track); + } + +//--------------------------------------------------------- // insertTrack //--------------------------------------------------------- @@ -322,17 +334,13 @@ void Song::insertTrack(Track* track, int idx) } insertTrack1(track, idx); - startUndo(); undoOp(UndoOp::AddTrack, idx, track); AudioMsg msg; msg.id = SEQM_ADD_TRACK; msg.track = track; msg.ival = idx; audio->sendMsg(&msg); - endUndo(SC_TRACK_INSERTED | SC_ROUTE); - emit trackAdded(track, idx); - selectTrack(track); } //--------------------------------------------------------- |