summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-11-07 00:30:20 +0000
committerTim E. Real <termtech@rogers.com>2010-11-07 00:30:20 +0000
commit4ea1c4ed67ee6fd46dbe393d05b7d835e3a33299 (patch)
tree599bf37fa6965cfb4cb310a806c6f35f10a6e505 /muse2
parent13375b925494553cb3534ca769ad04e4f8cffb24 (diff)
All routing popups finished. Major cleanup of astrip + mstrip comments, code!
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog8
-rw-r--r--muse2/muse/app.cpp6
-rw-r--r--muse2/muse/arranger/trackinfo.cpp43
-rw-r--r--muse2/muse/mixer/astrip.cpp1272
-rw-r--r--muse2/muse/mixer/astrip.h3
-rw-r--r--muse2/muse/mixer/mstrip.cpp219
-rw-r--r--muse2/muse/mixer/mstrip.h3
-rw-r--r--muse2/muse/widgets/popupmenu.cpp4
8 files changed, 201 insertions, 1357 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 47859942..ffb91b58 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,9 +1,9 @@
06.11.2010
- Yipee! De retour aux les popup menus 'stay-open'. (Tim)
- - Fixed PopupMenu class.
- Work in progress. Currently midi trackinfo 'iR' button routing is complete.
- TODO: Strip routing popups. Also, try to eliminate global routing menu map (gRoutingMenuMap)
- and directly store the routes as QVariant action user data. Someone started this already...
+ - Fixed PopupMenu class. All routing popups done (midi trackinfo, midi strip, audio strip).
+ TODO: Fix midi 'toggle all'. Use routes as QVariant action user data (someone started this already)...
+ - Major cleanup of audio and midi strip comments, code. (A fresh start for your tired eyes, you guys...)
+ - Test OK so far with all track types.
04.11.2010
- Fixed LADSPA plugin dialog. TODO: fix sorting order. (Tim)
- Fixed MenuTitleItem class. Fixed some usages of it (Jack popup routes, midi cfg routes). (Tim)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 6ce85950..f0d622b7 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -2065,7 +2065,7 @@ void MusE::updateRouteMenus(Track* track, QObject* master)
PopupMenu* pup = getRoutingPopupMenu();
- if(pup->actions().size() == 0)
+ if(pup->actions().isEmpty())
return;
if(!pup->isVisible())
@@ -2127,7 +2127,7 @@ void MusE::routingPopupMenuActivated(Track* track, int n)
{
PopupMenu* pup = getRoutingPopupMenu();
- if(pup->actions().size() == 0)
+ if(pup->actions().isEmpty())
return;
//MidiTrack* t = (MidiTrack*)track;
@@ -2597,7 +2597,7 @@ PopupMenu* MusE::prepareRoutingPopupMenu(Track* track, bool dst)
}
*/
- if(pup->actions().size() == 0)
+ if(pup->actions().isEmpty())
{
gRoutingPopupMenuMaster = 0;
//pup->clear();
diff --git a/muse2/muse/arranger/trackinfo.cpp b/muse2/muse/arranger/trackinfo.cpp
index b23cead8..ef191b97 100644
--- a/muse2/muse/arranger/trackinfo.cpp
+++ b/muse2/muse/arranger/trackinfo.cpp
@@ -577,19 +577,9 @@ void Arranger::iInputPortChanged(const QString& s)
//void Arranger::routingPopupMenuActivated(int n)
void Arranger::routingPopupMenuActivated(QAction* act)
{
- //if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack())
return;
- //if (n > 999) {
- //if (n >= MIDI_PORTS * MIDI_CHANNELS) { // p3.3.50
- // for (int i = 0; i < MIDI_CHANNELS; i++)
- //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
- // muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS)); // p3.3.50
- //}
- //else {
- ///muse->routingPopupMenuActivated(selected, n);
- muse->routingPopupMenuActivated(selected, act->data().toInt());
- //}
+ muse->routingPopupMenuActivated(selected, act->data().toInt());
}
#if 0
@@ -599,19 +589,9 @@ void Arranger::routingPopupMenuActivated(QAction* act)
void Arranger::routingPopupViewActivated(const QModelIndex& mdi)
{
- //if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack())
return;
- //if (n > 999) {
- //if (n >= MIDI_PORTS * MIDI_CHANNELS) { // p3.3.50
- // for (int i = 0; i < MIDI_CHANNELS; i++)
- //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
- // muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS)); // p3.3.50
- //}
- //else {
-/// muse->routingPopupMenuActivated(selected, n);
- muse->routingPopupMenuActivated(selected, mdi.data().toInt());
- //}
+ muse->routingPopupMenuActivated(selected, mdi.data().toInt());
}
#endif
@@ -623,25 +603,17 @@ void Arranger::inRoutesPressed()
{
if(!selected)
return;
-
- ///song->chooseMidiRoutes(midiTrackInfo->iRButton, (MidiTrack*)selected, false);
-
if(!selected->isMidiTrack())
return;
- //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, false);
//PopupView* pup = muse->prepareRoutingPopupView(selected, false);
if(!pup)
return;
- //pup->disconnect();
- //gRoutingPopupMenuMaster = this;
gRoutingPopupMenuMaster = midiTrackInfo;
- //connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
//connect(pup, SIGNAL(activated(const QModelIndex&)), SLOT(routingPopupViewActivated(const QModelIndex&)));
- // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
//connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupViewAboutToHide()));
pup->popup(QCursor::pos());
@@ -658,24 +630,17 @@ void Arranger::outRoutesPressed()
{
if(!selected)
return;
-
- ///song->chooseMidiRoutes(midiTrackInfo->oRButton, (MidiTrack*)selected, true);
-
if(!selected->isMidiTrack())
return;
- //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, true);
if(!pup)
return;
- //pup->disconnect();
- //gRoutingPopupMenuMaster = this;
gRoutingPopupMenuMaster = midiTrackInfo;
- connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
- // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
- pup->popup(QCursor::pos(), 0);
+ pup->popup(QCursor::pos());
midiTrackInfo->oRButton->setDown(false);
return;
}
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index dfcd741c..12aefef0 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -24,6 +24,8 @@
#include <qpoint.h>
#include <qevent.h>
#include <qwidget.h>
+#include <QVariant>
+#include <QAction>
//Added by qt3to4:
//#include <Q3HBoxLayout>
//#include <Q3GridLayout>
@@ -64,6 +66,8 @@ MenuTitleItem::MenuTitleItem(const QString& ss, QWidget* parent)
s = ss;
// Don't allow to click on it.
setEnabled(false);
+ // Just to be safe, set to -1 instead of default 0.
+ setData(-1);
}
QWidget* MenuTitleItem::createWidget(QWidget *parent)
@@ -959,40 +963,29 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
static int addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
{
// totalInChannels is only used by syntis.
- //int channels = (!isOutput || route_track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)route_track)->totalOutChannels() : ((AudioTrack*)route_track)->totalInChannels();
- //int channels = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
int toch = ((AudioTrack*)track)->totalOutChannels();
// If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
if(track->channels() == 1)
toch = 1;
- // totalInChannels is only used by syntis.
- ///int chans = (isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
-
// Don't add the last stray mono route if the track is stereo.
//if(route_track->channels() > 1 && (channel+1 == chans))
// return id;
RouteList* rl = isOutput ? track->outRoutes() : track->inRoutes();
- QString s(route_track->name());
- //int trackchans = track->channels();
- //QString ns;
+ QAction* act;
- //if(track->channels() > 1 && (channel+1 < channels))
- //if(track->channels() > 1)
- //if(route_track->type() == Track::AUDIO_SOFTSYNTH && channels > 2 && track->channels() > 1)
- ///if(track->type() == Track::AUDIO_SOFTSYNTH && chans > 2 && route_track->channels() > 1)
- /// s += QString(" < [%1,%2]").arg(channel+1).arg(channel+2);
+ QString s(route_track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
+ act = lb->addAction(s);
+ act->setData(id);
+ act->setCheckable(true);
int ach = channel;
int bch = -1;
Route r(route_track, isOutput ? ach : bch, channels);
- //Route r(route_track, channel);
r.remoteChannel = isOutput ? bch : ach;
@@ -1000,17 +993,6 @@ static int addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int
for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
{
- //if (ir->type == 0 && ir->track == track) {
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channels == channels)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track &&
- // (channel != -1 && ir->channel == channel) && (channels != -1 && ir->channels == channels))
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel)
- //printf("addMenuItem: ir->type:%d ir->track:%s track:%s ir->channel:%d channel:%d ir->channels:%d channels:%d\n",
- // ir->type, ir->track->name().latin1(), track->name().latin1(), ir->channel, channel, ir->channels, channels);
- //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == channel && ir->remoteChannel == r.remoteChannel)
- //if(*ir == r)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == channel && ir->channels == channels && ir->remoteChannel == r.remoteChannel)
-
if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->remoteChannel == r.remoteChannel)
{
int tcompch = r.channel;
@@ -1027,11 +1009,9 @@ static int addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int
if(compchs == -1)
compchs = isOutput ? track->channels() : ir->track->channels();
- //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == r.channel && ir->channels == r.channels && ir->remoteChannel == r.remoteChannel)
if(compch == tcompch && compchs == tcompchs)
{
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
@@ -1050,24 +1030,7 @@ static int addAuxPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, i
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
}
return id;
}
@@ -1083,24 +1046,7 @@ static int addInPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, in
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
}
return id;
}
@@ -1116,24 +1062,7 @@ static int addOutPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, i
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
}
return id;
}
@@ -1149,24 +1078,7 @@ static int addGroupPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm,
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
}
return id;
}
@@ -1182,24 +1094,7 @@ static int addWavePorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm,
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
}
return id;
}
@@ -1213,44 +1108,22 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
{
RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
+ QAction* act;
+
SynthIList* al = song->syntis();
for (iSynthI i = al->begin(); i != al->end(); ++i)
{
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, track, lb, r, id, mm, channel, channels);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
- //SynthI* synti = (SynthI*)track;
-
int toch = ((AudioTrack*)track)->totalOutChannels();
// If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
if(track->channels() == 1)
toch = 1;
- //int chans = synti->totalOutChannels();
- //int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
// totalInChannels is only used by syntis.
int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
- //int schans = synti->channels();
- //if(schans < chans)
- // chans = schans;
int tchans = (channels != -1) ? channels: t->channels();
if(tchans == 2)
{
@@ -1262,13 +1135,8 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
if(chans > 0)
{
- //QPopupMenu* chpup = new QPopupMenu(parent);
- //PopupMenu* chpup = new PopupMenu(parent);
- //PopupMenu* chpup = new PopupMenu(lb->parent());
- PopupMenu* chpup = new PopupMenu();
- //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
- lb->connect(chpup, SIGNAL(activated(int)), lb, SIGNAL(activated(int)));
- chpup->setCheckable(true);
+ PopupMenu* chpup = new PopupMenu(lb);
+ chpup->setTitle(track->name());
for(int ch = 0; ch < chans; ++ch)
{
char buffer[128];
@@ -1276,7 +1144,9 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
else
snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
- chpup->insertItem(QString(buffer), id);
+ act = chpup->addAction(QString(buffer));
+ act->setData(id);
+ act->setCheckable(true);
int ach = (channel == -1) ? ch : channel;
int bch = (channel == -1) ? -1 : ch;
@@ -1290,15 +1160,6 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
{
- //if (ir->type == 0 && ir->track == track) {
- //if(ir->type == 0 && ir->track == track && ir->channels == channels)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
- // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
- // ir->remoteChannel == rt.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
- // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
-
if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
{
int tcompch = rt.channel;
@@ -1317,7 +1178,7 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
if(compch == tcompch && compchs == tcompchs)
{
- chpup->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
@@ -1325,7 +1186,7 @@ static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
++id;
}
- lb->insertItem(track->name(), chpup);
+ lb->addMenu(chpup);
}
}
return id;
@@ -1343,43 +1204,23 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
toch = 1;
// Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
- //int chans = t->totalOutChannels();
// totalInChannels is only used by syntis.
- //int chans = isOutput ? t->totalOutChannels() : t->totalInChannels();
- //int chans = (isOutput || t->type() != Track::AUDIO_SOFTSYNTH) ? t->totalOutChannels() : t->totalInChannels();
int chans = (isOutput || t->type() != Track::AUDIO_SOFTSYNTH) ? toch : t->totalInChannels();
- // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
- //if(t->channels() == 1)
- // chans = 1;
-
if(chans > 1)
- {
- // pup->insertItem(new MenuTitleItem("<Mono>")); ddskrjo
- //pup->insertSeparator();
- }
+ pup->addAction(new MenuTitleItem("<Mono>", pup));
//
// If it's more than one channel, create a sub-menu. If it's just one channel, don't bother with a sub-menu...
//
- //QPopupMenu* chpup = pup;
PopupMenu* chpup = pup;
for(int ch = 0; ch < chans; ++ch)
{
// If more than one channel, create the sub-menu.
if(chans > 1)
- {
- //chpup = new QPopupMenu(parent);
- //chpup = new PopupMenu(parent);
- //chpup = new PopupMenu(pup->parent());
- chpup = new PopupMenu();
- //connect(chpup, SIGNAL(activated(int)), strip, SLOT(oRouteMenuActivated(int)));
- //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
- pup->connect(chpup, SIGNAL(activated(int)), pup, SIGNAL(activated(int)));
- chpup->setCheckable(true);
- }
+ chpup = new PopupMenu(pup);
if(isOutput)
{
@@ -1387,42 +1228,19 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
{
case Track::AUDIO_INPUT:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
case Track::WAVE:
case Track::AUDIO_GROUP:
case Track::AUDIO_SOFTSYNTH:
- //id = addOutPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
break;
case Track::AUDIO_AUX:
- //id = addOutPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput);
break;
default:
break;
-
- /*
- case Track::AUDIO_INPUT:
- id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
- case Track::WAVE:
- case Track::AUDIO_GROUP:
- case Track::AUDIO_SOFTSYNTH:
- id = addOutPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
- break;
- case Track::AUDIO_AUX:
- id = addOutPorts(parent, t, chpup, id, mm, ch, isOutput);
- break;
- default:
- break;
- */
}
}
else
@@ -1431,58 +1249,24 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
{
case Track::AUDIO_OUTPUT:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addAuxPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
id = addAuxPorts(t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
break;
case Track::WAVE:
- //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
break;
case Track::AUDIO_SOFTSYNTH:
case Track::AUDIO_GROUP:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
break;
default:
break;
-
- /*
- case Track::AUDIO_OUTPUT:
- id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addAuxPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
- break;
- case Track::WAVE:
- id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
- break;
- case Track::AUDIO_SOFTSYNTH:
- case Track::AUDIO_GROUP:
- id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
- id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
- break;
- default:
- break;
- */
}
}
@@ -1491,7 +1275,8 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
{
char buffer[128];
snprintf(buffer, 128, "%s %d", pup->tr("Channel").latin1(), ch+1);
- pup->insertItem(QString(buffer), chpup);
+ chpup->setTitle(QString(buffer));
+ pup->addMenu(chpup);
}
}
@@ -1502,55 +1287,38 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
// Ignore odd numbered left-over channels.
//int schans = (chans & ~1) - 1;
- pup->insertSeparator();
- //pup->insertItem(new MenuTitleItem("<Stereo>")); ddskrjo
- //pup->insertSeparator();
+ pup->addSeparator();
+ pup->addAction(new MenuTitleItem("<Stereo>", pup));
//
// If it's more than two channels, create a sub-menu. If it's just two channels, don't bother with a sub-menu...
//
- //QPopupMenu* chpup = pup;
chpup = pup;
if(chans <= 2)
// Just do one iteration.
chans = 1;
- //for(int ch = 0; ch < schans; ++ch)
for(int ch = 0; ch < chans; ++ch)
{
// If more than two channels, create the sub-menu.
if(chans > 2)
- {
- //chpup = new QPopupMenu(parent);
- //chpup = new PopupMenu(parent);
- //chpup = new PopupMenu(pup->parent());
- chpup = new PopupMenu();
- //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
- pup->connect(chpup, SIGNAL(activated(int)), pup, SIGNAL(activated(int)));
- chpup->setCheckable(true);
- }
+ chpup = new PopupMenu(pup);
if(isOutput)
{
switch(t->type())
{
case Track::AUDIO_INPUT:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
case Track::WAVE:
case Track::AUDIO_GROUP:
case Track::AUDIO_SOFTSYNTH:
- //id = addOutPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
break;
case Track::AUDIO_AUX:
- //id = addOutPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput);
break;
default:
@@ -1562,32 +1330,20 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
switch(t->type())
{
case Track::AUDIO_OUTPUT:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addAuxPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
id = addAuxPorts(t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
break;
case Track::WAVE:
- //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
break;
case Track::AUDIO_SOFTSYNTH:
case Track::AUDIO_GROUP:
- //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
- //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
break;
default:
@@ -1600,7 +1356,8 @@ static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenu
{
char buffer[128];
snprintf(buffer, 128, "%s %d,%d", pup->tr("Channel").latin1(), ch+1, ch+2);
- pup->insertItem(QString(buffer), chpup);
+ chpup->setTitle(QString(buffer));
+ pup->addMenu(chpup);
}
}
}
@@ -1616,38 +1373,19 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
{
RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
+ QAction* act;
SynthIList* al = song->syntis();
for (iSynthI i = al->begin(); i != al->end(); ++i)
{
Track* track = *i;
if (t == track)
continue;
- //id = addMenuItem(parent, track, lb, r, id, mm, channel, channels);
-
- /*
- QString s(track->name());
- //int it = lb->insertItem(s);
- lb->insertItem(s, id);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- //if (ir->type == 0 && ir->track == track) {
- if (ir->type == 0 && ir->track == track && ir->channels == channels) {
- //lb->setItemChecked(it, true);
- lb->setItemChecked(id, true);
- break;
- }
- }
- ++id;
- */
-
- //SynthI* synti = (SynthI*)track;
int toch = ((AudioTrack*)track)->totalOutChannels();
// If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
if(track->channels() == 1)
toch = 1;
- //int chans = synti->totalOutChannels();
- //int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
// totalInChannels is only used by syntis.
int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
@@ -1666,55 +1404,30 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
if(chans > 0)
{
- //QPopupMenu* chpup = new QPopupMenu(parent);
- //PopupMenu* chpup = new PopupMenu(parent);
- //PopupMenu* chpup = new PopupMenu(lb->parent());
- PopupMenu* chpup = new PopupMenu();
- //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
- lb->connect(chpup, SIGNAL(activated(int)), lb, SIGNAL(activated(int)));
- chpup->setCheckable(true);
-
+ PopupMenu* chpup = new PopupMenu(lb);
+ chpup->setTitle(track->name());
if(chans > 1)
- {
- //chpup->insertItem(new MenuTitleItem("<Mono>")); ddskrjo
- //pup->insertSeparator();
- }
+ chpup->addAction(new MenuTitleItem("<Mono>", chpup));
for(int ch = 0; ch < chans; ++ch)
{
char buffer[128];
- //if(tchans == 2)
- // snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
- //else
- snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
- chpup->insertItem(QString(buffer), id);
+ snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
+ act = chpup->addAction(QString(buffer));
+ act->setData(id);
+ act->setCheckable(true);
- //int ach = (channel == -1) ? ch : channel;
- //int bch = (channel == -1) ? -1 : ch;
int ach = ch;
int bch = -1;
- //Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans);
Route rt(track, isOutput ? bch : ach, 1);
- //Route rt(track, ch);
- //rt.remoteChannel = -1;
- //rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach;
rt.remoteChannel = isOutput ? ach : bch;
mm.insert( pRouteMenuMap(id, rt) );
for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
{
- //if (ir->type == 0 && ir->track == track) {
- //if(ir->type == 0 && ir->track == track && ir->channels == channels)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
- // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
- // ir->remoteChannel == rt.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
- // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
-
if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
{
int tcompch = rt.channel;
@@ -1733,7 +1446,7 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
if(compch == tcompch && compchs == tcompchs)
{
- chpup->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
@@ -1747,46 +1460,28 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
// Ignore odd numbered left-over channels.
//int schans = (chans & ~1) - 1;
- chpup->insertSeparator();
- //chpup->insertItem(new MenuTitleItem("<Stereo>")); ddskrjo
- //pup->insertSeparator();
+ chpup->addSeparator();
+ chpup->addAction(new MenuTitleItem("<Stereo>", chpup));
for(int ch = 0; ch < chans; ++ch)
{
char buffer[128];
- //if(tchans == 2)
- snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
- //else
- // snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
- chpup->insertItem(QString(buffer), id);
+ snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
+ act = chpup->addAction(QString(buffer));
+ act->setData(id);
+ act->setCheckable(true);
- //int ach = (channel == -1) ? ch : channel;
- //int bch = (channel == -1) ? -1 : ch;
int ach = ch;
int bch = -1;
- //Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans);
Route rt(track, isOutput ? bch : ach, 2);
- //Route rt(track, ch);
- //rt.remoteChannel = -1;
- //rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach;
rt.remoteChannel = isOutput ? ach : bch;
mm.insert( pRouteMenuMap(id, rt) );
for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
{
- //if (ir->type == 0 && ir->track == track) {
- //if(ir->type == 0 && ir->track == track && ir->channels == channels)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
- // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
- // ir->remoteChannel == rt.remoteChannel)
- //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
- // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
-
-
if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
{
int tcompch = rt.channel;
@@ -1805,7 +1500,7 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
if(compch == tcompch && compchs == tcompchs)
{
- chpup->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
@@ -1814,7 +1509,7 @@ static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMen
}
}
- lb->insertItem(track->name(), chpup);
+ lb->addMenu(chpup);
}
}
return id;
@@ -1829,33 +1524,21 @@ void AudioStrip::iRoutePressed()
//if(track->isMidiTrack() || (track->type() == Track::AUDIO_AUX) || (track->type() == Track::AUDIO_SOFTSYNTH))
if(!track || track->isMidiTrack() || track->type() == Track::AUDIO_AUX)
{
- //_isRoutingPopupMenuMaster = false;
gRoutingPopupMenuMaster = 0;
return;
}
QPoint ppt = QCursor::pos();
- //QPopupMenu* pup = new QPopupMenu(iR);
- //PopupMenu* pup = new PopupMenu(iR);
- //pup->setCheckable(true);
-
PopupMenu* pup = muse->getRoutingPopupMenu();
pup->disconnect();
AudioTrack* t = (AudioTrack*)track;
RouteList* irl = t->inRoutes();
+ QAction* act = 0;
int gid = 0;
- //int n;
- ///RouteMenuMap mm;
-
- // Routes can't be re-read until the message sent from msgAddRoute1()
- // has had time to be sent and actually affected the routes.
- ///_redisplay:
-
- //QPopupMenu* pup = new QPopupMenu(iR);
- //RouteList* irl = t->inRoutes();
+ int id = 0;
pup->clear();
gRoutingMenuMap.clear();
@@ -1865,20 +1548,15 @@ void AudioStrip::iRoutePressed()
{
case Track::AUDIO_INPUT:
{
- pup->setCheckable(true);
- //int gid = 0;
for(int i = 0; i < channel; ++i)
{
char buffer[128];
snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
- //MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
MenuTitleItem* titel = new MenuTitleItem(QString(buffer), pup);
- //pup->insertItem(titel); //ddskrjo
pup->addAction(titel);
if(!checkAudioDevice())
{
- ///delete pup;
gRoutingPopupMenuMaster = 0;
pup->clear();
gRoutingMenuMap.clear();
@@ -1888,8 +1566,11 @@ void AudioStrip::iRoutePressed()
std::list<QString> ol = audioDevice->outputPorts();
for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
{
- int id = pup->insertItem(*ip, (gid * 16) + i);
- //Route dst(*ip, true, i);
+ id = gid * 16 + i;
+ act = pup->addAction(*ip);
+ act->setData(id);
+ act->setCheckable(true);
+
Route dst(*ip, true, i, Route::JACK_ROUTE);
gRoutingMenuMap.insert( pRouteMenuMap(id, dst) );
++gid;
@@ -1897,13 +1578,13 @@ void AudioStrip::iRoutePressed()
{
if(*ir == dst)
{
- pup->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
}
if(i+1 != channel)
- pup->insertSeparator();
+ pup->addSeparator();
}
}
break;
@@ -1912,43 +1593,26 @@ void AudioStrip::iRoutePressed()
//case Track::AUDIO_GROUP:
case Track::AUDIO_OUTPUT:
- //gid = addWavePorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addGroupPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addAuxPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addAuxPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addSyntiPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = nonSyntiTrackAddSyntis(iR, t, pup, gid, gRoutingMenuMap, false);
- //gid = nonSyntiTrackAddSyntis(this, iR, t, pup, gid, gRoutingMenuMap, false);
gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false);
break;
case Track::WAVE:
- //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
break;
case Track::AUDIO_GROUP:
- //gid = addWavePorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addGroupPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = addSyntiPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
- //gid = nonSyntiTrackAddSyntis(iR, t, pup, gid, gRoutingMenuMap, false);
- //gid = nonSyntiTrackAddSyntis(this, iR, t, pup, gid, gRoutingMenuMap, false);
gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false);
break;
case Track::AUDIO_SOFTSYNTH:
- //gid = addMultiChannelPorts(iR, t, pup, gid, gRoutingMenuMap, false);
- //gid = addMultiChannelPorts(this, iR, t, pup, gid, gRoutingMenuMap, false);
gid = addMultiChannelPorts(t, pup, gid, gRoutingMenuMap, false);
break;
default:
- ///delete pup;
gRoutingPopupMenuMaster = 0;
pup->clear();
gRoutingMenuMap.clear();
@@ -1956,9 +1620,8 @@ void AudioStrip::iRoutePressed()
return;
}
- if(pup->count() == 0)
+ if(pup->actions().isEmpty())
{
- ///delete pup;
gRoutingPopupMenuMaster = 0;
gRoutingMenuMap.clear();
iR->setDown(false);
@@ -1967,406 +1630,143 @@ void AudioStrip::iRoutePressed()
gIsOutRoutingPopupMenu = false;
gRoutingPopupMenuMaster = this;
- connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
- pup->popup(ppt, 0);
+ pup->popup(ppt);
iR->setDown(false);
- return;
-
-
-
- /*
- //int n = pup->exec(QCursor::pos());
- // For some reason, after the first display, it won't redisplay at the same point if the menu is too high.
- n = pup->exec(ppt, 0);
- if(n != -1)
- {
- QString s(pup->text(n));
-
- if(track->type() == Track::AUDIO_INPUT)
- {
- ///delete pup;
- int chan = n & 0xf;
-
- Route srcRoute(s, false, -1, Route::JACK_ROUTE);
- Route dstRoute(t, chan);
-
- srcRoute.channel = chan;
-
- iRoute iir = irl->begin();
- for(; iir != irl->end(); ++iir)
- {
- if(*iir == srcRoute)
- break;
- }
- if(iir != irl->end())
- // disconnect
- audio->msgRemoveRoute(srcRoute, dstRoute);
- else
- // connect
- audio->msgAddRoute(srcRoute, dstRoute);
-
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
- iR->setDown(false); // pup->exec() catches mouse release event
- return;
-
- // p3.3.46
- ///goto _redisplay;
- }
-
- iRouteMenuMap imm = mm.find(n);
- if(imm == mm.end())
- {
- delete pup;
- iR->setDown(false); // pup->exec() catches mouse release event
- return;
- }
-
- //int chan = n >> 16;
- //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
- //chan &= 0xffff;
- //int chan = imm->second.channel;
- //int chans = imm->second.channels;
-
- //Route srcRoute(s, false, -1);
- //Route srcRoute(s, false, -1, Route::TRACK_ROUTE);
- Route &srcRoute = imm->second;
-
- //Route dstRoute(t, -1);
- //Route dstRoute(t, chan, chans);
- Route dstRoute(t, imm->second.channel, imm->second.channels);
- //Route dstRoute(t, imm->second.channel);
- dstRoute.remoteChannel = imm->second.remoteChannel;
-
- iRoute iir = irl->begin();
- for (; iir != irl->end(); ++iir) {
- if (*iir == srcRoute)
- break;
- }
- if (iir != irl->end()) {
- // disconnect
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- // p3.3.46
- //iR->setDown(false); // pup->exec() catches mouse release event
- ///goto _redisplay;
-
- }
-
- delete pup;
- iR->setDown(false); // pup->exec() catches mouse release event
- */
-
}
-#if 0
//---------------------------------------------------------
-// updateRouteMenus
+// routingPopupMenuActivated
//---------------------------------------------------------
-void AudioStrip::updateRouteMenus()
+void AudioStrip::routingPopupMenuActivated(QAction* act)
{
- //if(!_isRoutingPopupMenuMaster || track->isMidiTrack() || (track->type() == Track::AUDIO_AUX))
if(!track || gRoutingPopupMenuMaster != this || track->isMidiTrack())
return;
-
- ///QPopupMenu* pup = new QPopupMenu(oR);
- // p3.3.47
- //if(!orpup)
- // return;
- //QPopupMenu* pup = muse->getORoutesPopup();
PopupMenu* pup = muse->getRoutingPopupMenu();
- if(pup->count() == 0)
+ if(pup->actions().isEmpty())
return;
- //pup->setCheckable(true);
AudioTrack* t = (AudioTrack*)track;
RouteList* rl = gIsOutRoutingPopupMenu ? t->outRoutes() : t->inRoutes();
-
- //int gid = 0;
- //int n;
- ///RouteMenuMap mm;
-
- //QPoint ppt = QCursor::pos();
+ int n = act->data().toInt();
+ if (n == -1)
+ return;
- /*
- iRoute iorl = orl->begin();
- for(; iorl != orl->end(); ++iorl)
- {
- iRouteMenuMap imm = ormm->begin();
- for(; imm != ormm->end(); ++imm)
+ if(gIsOutRoutingPopupMenu)
+ {
+ if(track->type() == Track::AUDIO_OUTPUT)
{
- if(*iorl == imm->second)
- {
- orpup->setItemChecked(imm->first, true);
- break;
- }
+
+ int chan = n & 0xf;
+
+ Route srcRoute(t, chan);
+ Route dstRoute(act->text(), true, -1, Route::JACK_ROUTE);
+ dstRoute.channel = chan;
+
+ // check if route src->dst exists:
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ return;
}
- //if(imm == ormm->end())
- //{
- //}
- }
- //if (iorl == orl->end())
- //{
- //}
- */
-
- iRouteMenuMap imm = gRoutingMenuMap.begin();
- for(; imm != gRoutingMenuMap.end(); ++imm)
- {
- bool found = false;
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ return;
+
+ Route srcRoute(t, imm->second.channel, imm->second.channels);
+ srcRoute.remoteChannel = imm->second.remoteChannel;
+
+ Route &dstRoute = imm->second;
+
+ // check if route src->dst exists:
iRoute irl = rl->begin();
- for(; irl != rl->end(); ++irl)
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ }
+ else
+ {
+ if(track->type() == Track::AUDIO_INPUT)
{
- if(*irl == imm->second)
+ int chan = n & 0xf;
+
+ Route srcRoute(act->text(), false, -1, Route::JACK_ROUTE);
+ Route dstRoute(t, chan);
+
+ srcRoute.channel = chan;
+
+ iRoute irl = rl->begin();
+ for(; irl != rl->end(); ++irl)
{
- found = true;
- break;
+ if(*irl == srcRoute)
+ break;
}
+ if(irl != rl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ return;
}
- pup->setItemChecked(imm->first, found);
- }
-
- return;
-}
-#endif
-
-//---------------------------------------------------------
-// routingPopupMenuActivated
-//---------------------------------------------------------
-
-void AudioStrip::routingPopupMenuActivated(int n)
-{
- if(!track || gRoutingPopupMenuMaster != this || track->isMidiTrack())
- return;
-
- PopupMenu* pup = muse->getRoutingPopupMenu();
-
- //printf("AudioStrip::routingPopupMenuActivated n:%d count:%d\n", n, pup->count());
-
- if(pup->count() == 0)
- return;
- AudioTrack* t = (AudioTrack*)track;
- RouteList* rl = gIsOutRoutingPopupMenu ? t->outRoutes() : t->inRoutes();
-
- //QPoint ppt = QCursor::pos();
-
- // p3.3.47
- if (n == -1)
- {
- //printf("AudioStrip::routingPopupMenuActivated n = -1\n");
- ///delete pup;
- return;
- }
- else
- //if(n == 0)
- //{
- //printf("AudioStrip::routingPopupMenuActivated n = 0 = tearOffHandle\n");
- //oR->setDown(false);
- // return;
- //}
- //else
- {
- if(gIsOutRoutingPopupMenu)
- {
- QString s(pup->text(n));
-
- //printf("AudioStrip::routingPopupMenuActivated text:%s\n", s.latin1());
-
- if(track->type() == Track::AUDIO_OUTPUT)
- {
- ///delete orpup;
-
- int chan = n & 0xf;
-
- //Route srcRoute(t, -1);
- //Route srcRoute(t, chan, chans);
- //Route srcRoute(t, chan, 1);
- Route srcRoute(t, chan);
-
- //Route dstRoute(s, true, -1);
- Route dstRoute(s, true, -1, Route::JACK_ROUTE);
- //Route dstRoute(s, true, 0, Route::JACK_ROUTE);
-
- //srcRoute.channel = dstRoute.channel = chan;
- dstRoute.channel = chan;
- //dstRoute.channels = 1;
-
- // check if route src->dst exists:
- iRoute irl = rl->begin();
- for (; irl != rl->end(); ++irl) {
- if (*irl == dstRoute)
- break;
- }
- if (irl != rl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- // p3.3.47
- //pup->popup(ppt, 0);
-
- //oR->setDown(false);
- return;
-
- // p3.3.46
- ///goto _redisplay;
- }
-
- iRouteMenuMap imm = gRoutingMenuMap.find(n);
- if(imm == gRoutingMenuMap.end())
- {
- ///delete orpup;
- //oR->setDown(false); // orpup->exec() catches mouse release event
- return;
- }
-
- //int chan = n >> 16;
- //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
- //chan &= 0xffff;
- //int chan = imm->second.channel;
- //int chans = imm->second.channels;
-
- //Route srcRoute(t, -1);
- //srcRoute.remoteChannel = chan;
- //Route srcRoute(t, chan, chans);
- Route srcRoute(t, imm->second.channel, imm->second.channels);
- //Route srcRoute(t, imm->second.channel);
- srcRoute.remoteChannel = imm->second.remoteChannel;
-
- //Route dstRoute(s, true, -1);
- //Route dstRoute(s, true, -1, Route::TRACK_ROUTE);
- Route &dstRoute = imm->second;
-
- // check if route src->dst exists:
- iRoute irl = rl->begin();
- for (; irl != rl->end(); ++irl) {
- if (*irl == dstRoute)
- break;
- }
- if (irl != rl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- // p3.3.46
- //oR->setDown(false);
- ///goto _redisplay;
-
- // p3.3.47
- //pup->popup(ppt, 0);
- }
- else
- {
- QString s(pup->text(n));
-
- if(track->type() == Track::AUDIO_INPUT)
- {
- ///delete pup;
- int chan = n & 0xf;
-
- Route srcRoute(s, false, -1, Route::JACK_ROUTE);
- Route dstRoute(t, chan);
-
- srcRoute.channel = chan;
-
- iRoute irl = rl->begin();
- for(; irl != rl->end(); ++irl)
- {
- if(*irl == srcRoute)
- break;
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ return;
+
+ Route &srcRoute = imm->second;
+
+ Route dstRoute(t, imm->second.channel, imm->second.channels);
+ dstRoute.remoteChannel = imm->second.remoteChannel;
+
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == srcRoute)
+ break;
}
- if(irl != rl->end())
- // disconnect
- audio->msgRemoveRoute(srcRoute, dstRoute);
- else
- // connect
- audio->msgAddRoute(srcRoute, dstRoute);
-
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
- //iR->setDown(false); // pup->exec() catches mouse release event
- return;
-
- // p3.3.46
- ///goto _redisplay;
- }
-
- iRouteMenuMap imm = gRoutingMenuMap.find(n);
- if(imm == gRoutingMenuMap.end())
- {
- //delete pup;
- //iR->setDown(false); // pup->exec() catches mouse release event
- return;
- }
-
- //int chan = n >> 16;
- //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
- //chan &= 0xffff;
- //int chan = imm->second.channel;
- //int chans = imm->second.channels;
-
- //Route srcRoute(s, false, -1);
- //Route srcRoute(s, false, -1, Route::TRACK_ROUTE);
- Route &srcRoute = imm->second;
-
- //Route dstRoute(t, -1);
- //Route dstRoute(t, chan, chans);
- Route dstRoute(t, imm->second.channel, imm->second.channels);
- //Route dstRoute(t, imm->second.channel);
- dstRoute.remoteChannel = imm->second.remoteChannel;
-
- iRoute irl = rl->begin();
- for (; irl != rl->end(); ++irl) {
- if (*irl == srcRoute)
- break;
- }
- if (irl != rl->end()) {
- // disconnect
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- // p3.3.46
- //iR->setDown(false);
- ///goto _redisplay;
-
- }
-
+ if (irl != rl->end()) {
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
}
-
- ///delete pup;
- //oR->setDown(false);
}
//---------------------------------------------------------
@@ -2383,52 +1783,33 @@ void AudioStrip::oRoutePressed()
QPoint ppt = QCursor::pos();
- ///QPopupMenu* pup = new QPopupMenu(oR);
-
PopupMenu* pup = muse->getRoutingPopupMenu();
pup->disconnect();
- //pup->setCheckable(true);
AudioTrack* t = (AudioTrack*)track;
RouteList* orl = t->outRoutes();
+ QAction* act = 0;
int gid = 0;
- //int n;
- ///RouteMenuMap mm;
-
- // Routes can't be re-read until the message sent from msgAddRoute1()
- // has had time to be sent and actually affected the routes.
-/// _redisplay:
-
- //QPopupMenu* pup = new QPopupMenu(oR);
- //RouteList* orl = t->outRoutes();
+ int id = 0;
pup->clear();
gRoutingMenuMap.clear();
gid = 0;
- // p3.3.47
- //orpup->insertTearOffHandle(gid);
- //gid++;
-
switch(track->type())
{
case Track::AUDIO_OUTPUT:
{
- pup->setCheckable(true);
- //int gid = 0;
for(int i = 0; i < channel; ++i)
{
char buffer[128];
snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
- //MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
MenuTitleItem* titel = new MenuTitleItem(QString(buffer), pup);
- //pup->insertItem(titel); //ddskrjo
pup->addAction(titel);
if(!checkAudioDevice())
{
- ///delete pup;
gRoutingPopupMenuMaster = 0;
pup->clear();
gRoutingMenuMap.clear();
@@ -2438,8 +1819,11 @@ void AudioStrip::oRoutePressed()
std::list<QString> ol = audioDevice->inputPorts();
for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
{
- int id = pup->insertItem(*ip, (gid * 16) + i);
- //Route dst(*ip, true, i);
+ id = gid * 16 + i;
+ act = pup->addAction(*ip);
+ act->setData(id);
+ act->setCheckable(true);
+
Route dst(*ip, true, i, Route::JACK_ROUTE);
gRoutingMenuMap.insert( pRouteMenuMap(id, dst) );
++gid;
@@ -2447,13 +1831,13 @@ void AudioStrip::oRoutePressed()
{
if(*ir == dst)
{
- pup->setItemChecked(id, true);
+ act->setChecked(true);
break;
}
}
}
if(i+1 != channel)
- pup->insertSeparator();
+ pup->addSeparator();
}
}
break;
@@ -2462,36 +1846,24 @@ void AudioStrip::oRoutePressed()
//case Track::AUDIO_GROUP:
case Track::AUDIO_SOFTSYNTH:
- //addOutPorts(t, pup, orl);
- //addGroupPorts(t, pup, orl);
- //gid = addMultiChannelPorts(oR, t, pup, gid, gRoutingMenuMap, true);
- //gid = addMultiChannelPorts(this, oR, t, pup, gid, gRoutingMenuMap, true);
gid = addMultiChannelPorts(t, pup, gid, gRoutingMenuMap, true);
break;
case Track::AUDIO_INPUT:
- //gid = addWavePorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
case Track::WAVE:
case Track::AUDIO_GROUP:
case Track::AUDIO_AUX:
//case Track::AUDIO_SOFTSYNTH:
- //gid = addOutPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
- //gid = addGroupPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
gid = addOutPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
gid = addGroupPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
- //gid = addSyntiPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
- //gid = nonSyntiTrackAddSyntis(oR, t, pup, gid, gRoutingMenuMap, true);
- //gid = nonSyntiTrackAddSyntis(this, oR, t, pup, gid, gRoutingMenuMap, true);
gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, true);
break;
//case Track::AUDIO_AUX:
- //gid = addOutPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
// gid = addOutPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
//break;
default:
- ///delete pup;
gRoutingPopupMenuMaster = 0;
pup->clear();
gRoutingMenuMap.clear();
@@ -2499,315 +1871,19 @@ void AudioStrip::oRoutePressed()
return;
}
- if(pup->count() == 0)
+ if(pup->actions().isEmpty())
{
- ///delete pup;
gRoutingPopupMenuMaster = 0;
gRoutingMenuMap.clear();
oR->setDown(false);
return;
}
- //int n = pup->exec(QCursor::pos());
- ///n = pup->exec(ppt);
gIsOutRoutingPopupMenu = true;
gRoutingPopupMenuMaster = this;
- connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
- pup->popup(ppt, 0);
+ pup->popup(ppt);
oR->setDown(false);
- return;
-
-
- /*
- // p3.3.47
- if(n == 0)
- {
- printf("AudioStrip::oRoutePressed n = 0 = tearOffHandle\n");
- oR->setDown(false); // orpup->exec() catches mouse release event
- return;
- }
- else
-
- if (n != -1) {
- QString s(orpup->text(n));
-
- if(track->type() == Track::AUDIO_OUTPUT)
- {
- delete orpup;
-
- int chan = n & 0xf;
-
- //Route srcRoute(t, -1);
- //Route srcRoute(t, chan, chans);
- //Route srcRoute(t, chan, 1);
- Route srcRoute(t, chan);
-
- //Route dstRoute(s, true, -1);
- Route dstRoute(s, true, -1, Route::JACK_ROUTE);
- //Route dstRoute(s, true, 0, Route::JACK_ROUTE);
-
- //srcRoute.channel = dstRoute.channel = chan;
- dstRoute.channel = chan;
- //dstRoute.channels = 1;
-
- // check if route src->dst exists:
- iRoute iorl = orl->begin();
- for (; iorl != orl->end(); ++iorl) {
- if (*iorl == dstRoute)
- break;
- }
- if (iorl != orl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- oR->setDown(false); // orpup->exec() catches mouse release event
- return;
-
- // p3.3.46
- ///goto _redisplay;
- }
-
- iRouteMenuMap imm = ormm.find(n);
- if(imm == ormm.end())
- {
- delete orpup;
- oR->setDown(false); // orpup->exec() catches mouse release event
- return;
- }
-
- //int chan = n >> 16;
- //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
- //chan &= 0xffff;
- //int chan = imm->second.channel;
- //int chans = imm->second.channels;
-
- //Route srcRoute(t, -1);
- //srcRoute.remoteChannel = chan;
- //Route srcRoute(t, chan, chans);
- Route srcRoute(t, imm->second.channel, imm->second.channels);
- //Route srcRoute(t, imm->second.channel);
- srcRoute.remoteChannel = imm->second.remoteChannel;
-
- //Route dstRoute(s, true, -1);
- //Route dstRoute(s, true, -1, Route::TRACK_ROUTE);
- Route &dstRoute = imm->second;
-
- // check if route src->dst exists:
- iRoute iorl = orl->begin();
- for (; iorl != orl->end(); ++iorl) {
- if (*iorl == dstRoute)
- break;
- }
- if (iorl != orl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
-
- // p3.3.46
- //oR->setDown(false); // orpup->exec() catches mouse release event
- ///goto _redisplay;
-
- }
-
- delete orpup;
- oR->setDown(false); // pup->exec() catches mouse release event
- */
}
-/*
-//---------------------------------------------------------
-// iRoutePressed
-//---------------------------------------------------------
-
-void AudioStrip::iRoutePressed()
- {
- QPopupMenu* pup = new QPopupMenu(iR);
- pup->setCheckable(true);
- AudioTrack* t = (AudioTrack*)track;
- RouteList* irl = t->inRoutes();
-
- switch(track->type()) {
- case Track::MIDI:
- case Track::DRUM:
- case Track::AUDIO_AUX:
- case Track::AUDIO_SOFTSYNTH:
- delete pup;
- return;
- case Track::AUDIO_INPUT:
- {
- int gid = 0;
- for (int i = 0; i < channel; ++i) {
- char buffer[128];
- snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
- MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
- pup->insertItem(titel);
-
- if (!checkAudioDevice()) return;
- std::list<QString> ol = audioDevice->outputPorts();
- for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
- int id = pup->insertItem(*ip, (gid * 16) + i);
- //Route dst(*ip, true, i);
- Route dst(*ip, true, i, Route::JACK_ROUTE);
- ++gid;
- for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
- if (*ir == dst) {
- pup->setItemChecked(id, true);
- break;
- }
- }
- }
- if (i+1 != channel)
- pup->insertSeparator();
- }
- }
- break;
- case Track::AUDIO_OUTPUT:
- addWavePorts(t, pup, irl);
- addInPorts(t, pup, irl);
- addGroupPorts(t, pup, irl);
- addAuxPorts(t, pup, irl);
- addSyntiPorts(t, pup, irl);
- break;
- case Track::WAVE:
- addInPorts(t, pup, irl);
- break;
- case Track::AUDIO_GROUP:
- addWavePorts(t, pup, irl);
- addInPorts(t, pup, irl);
- addGroupPorts(t, pup, irl);
- addSyntiPorts(t, pup, irl);
- break;
- }
- int n = pup->exec(QCursor::pos());
- if (n != -1) {
- QString s(pup->text(n));
-
- //Route srcRoute(s, false, -1);
- Route srcRoute(s, false, -1, (track->type() == Track::AUDIO_INPUT) ? Route::JACK_ROUTE : Route::TRACK_ROUTE);
- Route dstRoute(t, -1);
-
- if (track->type() == Track::AUDIO_INPUT)
- srcRoute.channel = dstRoute.channel = n & 0xf;
- iRoute iir = irl->begin();
- for (; iir != irl->end(); ++iir) {
- if (*iir == srcRoute)
- break;
- }
- if (iir != irl->end()) {
- // disconnect
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
- }
- delete pup;
- iR->setDown(false); // pup->exec() catches mouse release event
- }
-*/
-
-/*
-//---------------------------------------------------------
-// oRoutePressed
-//---------------------------------------------------------
-
-void AudioStrip::oRoutePressed()
- {
- QPopupMenu* pup = new QPopupMenu(oR);
- pup->setCheckable(true);
- AudioTrack* t = (AudioTrack*)track;
- RouteList* orl = t->outRoutes();
-
- switch(track->type()) {
- case Track::MIDI:
- case Track::DRUM:
- delete pup;
- return;
- case Track::AUDIO_OUTPUT:
- {
- int gid = 0;
- for (int i = 0; i < channel; ++i) {
- char buffer[128];
- snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
- MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
- pup->insertItem(titel);
-
- if (!checkAudioDevice()) return;
- std::list<QString> ol = audioDevice->inputPorts();
- for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
- int id = pup->insertItem(*ip, (gid * 16) + i);
- //Route dst(*ip, true, i);
- Route dst(*ip, true, i, Route::JACK_ROUTE);
- ++gid;
- for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
- if (*ir == dst) {
- pup->setItemChecked(id, true);
- break;
- }
- }
- }
- if (i+1 != channel)
- pup->insertSeparator();
- }
- }
- break;
- case Track::AUDIO_INPUT:
- addWavePorts(t, pup, orl);
- case Track::WAVE:
- case Track::AUDIO_GROUP:
- case Track::AUDIO_SOFTSYNTH:
- addOutPorts(t, pup, orl);
- addGroupPorts(t, pup, orl);
- break;
- case Track::AUDIO_AUX:
- addOutPorts(t, pup, orl);
- break;
- }
- int n = pup->exec(QCursor::pos());
- if (n != -1) {
- QString s(pup->text(n));
- Route srcRoute(t, -1);
- //Route dstRoute(s, true, -1);
- Route dstRoute(s, true, -1, (track->type() == Track::AUDIO_OUTPUT) ? Route::JACK_ROUTE : Route::TRACK_ROUTE);
-
- if (track->type() == Track::AUDIO_OUTPUT)
- srcRoute.channel = dstRoute.channel = n & 0xf;
-
- // check if route src->dst exists:
- iRoute iorl = orl->begin();
- for (; iorl != orl->end(); ++iorl) {
- if (*iorl == dstRoute)
- break;
- }
- if (iorl != orl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
- }
- delete pup;
- oR->setDown(false); // pup->exec() catches mouse release event
- }
-*/
diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h
index 82662b2b..bd3a1fa8 100644
--- a/muse2/muse/mixer/astrip.h
+++ b/muse2/muse/mixer/astrip.h
@@ -18,6 +18,7 @@ class Slider;
class Knob;
class QDialog;
class QToolButton;
+class QAction;
//class QPopupMenu;
class PopupMenu;
class QButton;
@@ -66,7 +67,7 @@ class AudioStrip : public Strip {
void offToggled(bool);
void iRoutePressed();
void oRoutePressed();
- void routingPopupMenuActivated(int /*id*/);
+ void routingPopupMenuActivated(QAction*);
void auxChanged(double, int);
void volumeChanged(double);
void volumePressed();
diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp
index 92d2d02f..6ec47f24 100644
--- a/muse2/muse/mixer/mstrip.cpp
+++ b/muse2/muse/mixer/mstrip.cpp
@@ -9,6 +9,7 @@
#include <fastlog.h>
#include <QLayout>
+#include <QAction>
#include <qapplication.h>
#include <qdialog.h>
#include <qtoolbutton.h>
@@ -965,11 +966,12 @@ void MidiStrip::updateOffState() // Ripped from AudioStrip, hehh(mg)
// routingPopupMenuActivated
//---------------------------------------------------------
-void MidiStrip::routingPopupMenuActivated(int n)
+void MidiStrip::routingPopupMenuActivated(QAction* act)
{
if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
return;
- muse->routingPopupMenuActivated(track, n);
+
+ muse->routingPopupMenuActivated(track, act->data().toInt());
}
//---------------------------------------------------------
@@ -981,131 +983,15 @@ void MidiStrip::iRoutePressed()
if(!track || !track->isMidiTrack())
return;
- //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
PopupMenu* pup = muse->prepareRoutingPopupMenu(track, false);
if(!pup)
return;
- //pup->disconnect();
gRoutingPopupMenuMaster = this;
- connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
- pup->popup(QCursor::pos(), 0);
+ pup->popup(QCursor::pos());
iR->setDown(false);
- return;
-
- /*
- RouteList* irl = track->inRoutes();
- //Route dst(track, -1);
-
- QPopupMenu* pup = new QPopupMenu(iR);
- pup->setCheckable(true);
-
- int gid = 0;
-
- //MidiInPortList* tl = song->midiInPorts();
- //for(iMidiInPort i = tl->begin();i != tl->end(); ++i)
- for(int i = 0; i < MIDI_PORTS; ++i)
- {
- //MidiInPort* track = *i;
- // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick wth ports.
- MidiPort* mp = &midiPorts[i];
- MidiDevice* md = mp->device();
- if(!md)
- continue;
-
- if(!(md->rwFlags() & 2))
- continue;
-
- //printf("MidiStrip::iRoutePressed adding submenu portnum:%d\n", i);
-
- //QMenu* m = menu->addMenu(track->name());
- QPopupMenu* subp = new QPopupMenu(iR);
-
- for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
- {
- //QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
- //subp->insertItem(QT_TR_NOOP(QString("Channel %1").arg(ch+1)), i * MIDI_CHANNELS + ch);
- gid = i * MIDI_CHANNELS + ch;
-
- //printf("MidiStrip::iRoutePressed inserting gid:%d\n", gid);
-
- subp->insertItem(QString("Channel %1").arg(ch+1), gid);
- //a->setCheckable(true);
- //Route src(track, ch, RouteNode::TRACK);
- //Route src(md, ch);
- //Route r = Route(src, dst);
- //a->setData(QVariant::fromValue(r));
- //a->setChecked(rl->indexOf(r) != -1);
- Route srcRoute(md, ch);
- for(iRoute ir = irl->begin(); ir != irl->end(); ++ir)
- {
- //if(*ir == dst)
- if(*ir == srcRoute)
- {
- subp->setItemChecked(gid, true);
- break;
- }
- }
- }
- pup->insertItem(QT_TR_NOOP(md->name()), subp);
- }
-
- int n = pup->exec(QCursor::pos());
- delete pup;
- if (n != -1)
- {
- int mdidx = n / MIDI_CHANNELS;
- int ch = n % MIDI_CHANNELS;
-
- //if(debugMsg)
- printf("MidiStrip::iRoutePressed mdidx:%d ch:%d\n", mdidx, ch);
-
- MidiPort* mp = &midiPorts[mdidx];
- MidiDevice* md = mp->device();
- if(!md)
- return;
-
- if(!(md->rwFlags() & 2))
- return;
-
-
- //QString s(pup->text(n));
- //QT_TR_NOOP(md->name())
-
- //Route srcRoute(s, false, -1);
- Route srcRoute(md, ch);
- //Route srcRoute(md, -1);
- //Route dstRoute(track, -1);
- Route dstRoute(track, ch);
-
- //if (track->type() == Track::AUDIO_INPUT)
- // srcRoute.channel = dstRoute.channel = n & 0xf;
- iRoute iir = irl->begin();
- for (; iir != irl->end(); ++iir) {
- if (*iir == srcRoute)
- break;
- }
- if (iir != irl->end()) {
- // disconnect
- printf("MidiStrip::iRoutePressed removing route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect
- printf("MidiStrip::iRoutePressed adding route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- printf("MidiStrip::iRoutePressed calling msgUpdateSoloStates\n");
- audio->msgUpdateSoloStates();
- printf("MidiStrip::iRoutePressed calling song->update\n");
- song->update(SC_ROUTE);
- }
- //delete pup;
- iR->setDown(false); // pup->exec() catches mouse release event
- printf("MidiStrip::iRoutePressed end\n");
- */
-
}
//---------------------------------------------------------
@@ -1113,104 +999,19 @@ void MidiStrip::iRoutePressed()
//---------------------------------------------------------
void MidiStrip::oRoutePressed()
- {
+{
if(!track || !track->isMidiTrack())
return;
- //song->chooseMidiRoutes(oR, (MidiTrack*)track, true);
PopupMenu* pup = muse->prepareRoutingPopupMenu(track, true);
if(!pup)
return;
- //pup->disconnect();
gRoutingPopupMenuMaster = this;
- connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*)));
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
- pup->popup(QCursor::pos(), 0);
+ pup->popup(QCursor::pos());
oR->setDown(false);
- return;
-
- /*
- QPopupMenu* pup = new QPopupMenu(oR);
- pup->setCheckable(true);
- AudioTrack* t = (AudioTrack*)track;
- RouteList* orl = t->outRoutes();
-
- switch(track->type()) {
- case Track::MIDI:
- case Track::DRUM:
- delete pup;
- return;
- case Track::AUDIO_OUTPUT:
- {
- int gid = 0;
- for (int i = 0; i < channel; ++i) {
- char buffer[128];
- snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
- MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
- pup->insertItem(titel);
-
- if (!checkAudioDevice()) return;
- std::list<QString> ol = audioDevice->inputPorts();
- for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
- int id = pup->insertItem(*ip, (gid * 16) + i);
- Route dst(*ip, true, i);
- ++gid;
- for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
- if (*ir == dst) {
- pup->setItemChecked(id, true);
- break;
- }
- }
- }
- if (i+1 != channel)
- pup->insertSeparator();
- }
- }
- break;
- case Track::AUDIO_INPUT:
- addWavePorts(t, pup, orl);
- case Track::WAVE:
- case Track::AUDIO_GROUP:
- case Track::AUDIO_SOFTSYNTH:
- addOutPorts(t, pup, orl);
- addGroupPorts(t, pup, orl);
- break;
- case Track::AUDIO_AUX:
- addOutPorts(t, pup, orl);
- break;
- }
- int n = pup->exec(QCursor::pos());
- if (n != -1) {
- QString s(pup->text(n));
- Route srcRoute(t, -1);
- Route dstRoute(s, true, -1);
-
- if (track->type() == Track::AUDIO_OUTPUT)
- srcRoute.channel = dstRoute.channel = n & 0xf;
-
- // check if route src->dst exists:
- iRoute iorl = orl->begin();
- for (; iorl != orl->end(); ++iorl) {
- if (*iorl == dstRoute)
- break;
- }
- if (iorl != orl->end()) {
- // disconnect if route exists
- audio->msgRemoveRoute(srcRoute, dstRoute);
- }
- else {
- // connect if route does not exist
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- audio->msgUpdateSoloStates();
- song->update(SC_ROUTE);
- }
- delete pup;
- oR->setDown(false); // pup->exec() catches mouse release event
- */
-
-
- }
+}
diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h
index 86eb3fac..d5776d43 100644
--- a/muse2/muse/mixer/mstrip.h
+++ b/muse2/muse/mixer/mstrip.h
@@ -20,6 +20,7 @@ class Knob;
class QString;
class MidiTrack;
class QLabel;
+class QAction;
//---------------------------------------------------------
// MidiStrip
@@ -56,7 +57,7 @@ class MidiStrip : public Strip {
//void routeClicked();
void iRoutePressed();
void oRoutePressed();
- void routingPopupMenuActivated(int /*id*/);
+ void routingPopupMenuActivated(QAction*);
void setVolume(double);
void setPan(double);
void setChorusSend(double);
diff --git a/muse2/muse/widgets/popupmenu.cpp b/muse2/muse/widgets/popupmenu.cpp
index 60729d69..618f0d19 100644
--- a/muse2/muse/widgets/popupmenu.cpp
+++ b/muse2/muse/widgets/popupmenu.cpp
@@ -8,9 +8,9 @@
// PopupMenu sub-class of QMenu created by Tim.
//=========================================================
+//#include <stdio.h>
#include <QMouseEvent>
#include <QAction>
-#include <stdio.h>
//#include <QStandardItemModel>
#include "popupmenu.h"
@@ -28,7 +28,7 @@ PopupMenu::PopupMenu(QWidget* parent)
PopupMenu::~PopupMenu()
{
- printf("PopupMenu::~PopupMenu\n"); // REMOVE Tim.
+ //printf("PopupMenu::~PopupMenu\n");
}
void PopupMenu::clear()