summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-12-21 17:54:10 +0000
committerFlorian Jung <flo@windfisch.org>2011-12-21 17:54:10 +0000
commit1fe51e45eebbfc2ac198ed4778c9afdb9eaf2ed0 (patch)
tree3d976c7966bec1f4d534a6281713ff36ec9cd3e8 /muse2/muse
parentc36a5508aa42e596b005425208054af9a60734b4 (diff)
merged again
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/app.cpp21
-rw-r--r--muse2/muse/app.h5
-rw-r--r--muse2/muse/appearance.cpp12
-rw-r--r--muse2/muse/arranger/alayout.cpp6
-rw-r--r--muse2/muse/arranger/arranger.cpp3
-rw-r--r--muse2/muse/arranger/pcanvas.cpp4
-rw-r--r--muse2/muse/arranger/tlist.cpp12
-rw-r--r--muse2/muse/arranger/tlist.h3
-rw-r--r--muse2/muse/driver/alsamidi.cpp39
-rw-r--r--muse2/muse/gconfig.cpp13
-rw-r--r--muse2/muse/helper.cpp15
-rw-r--r--muse2/muse/icons.cpp26
-rw-r--r--muse2/muse/icons.h5
-rw-r--r--muse2/muse/ladspa.h2
-rw-r--r--muse2/muse/liste/editevent.cpp2
-rw-r--r--muse2/muse/master/tscale.cpp2
-rw-r--r--muse2/muse/mixer/amixer.cpp2
-rw-r--r--muse2/muse/mixer/astrip.cpp32
-rw-r--r--muse2/muse/mixer/mstrip.cpp32
-rw-r--r--muse2/muse/node.cpp23
-rw-r--r--muse2/muse/plugin.cpp245
-rw-r--r--muse2/muse/plugin.h19
-rw-r--r--muse2/muse/widgets/CMakeLists.txt4
-rw-r--r--muse2/muse/widgets/custom_widget_actions.cpp196
-rw-r--r--muse2/muse/widgets/custom_widget_actions.h86
-rw-r--r--muse2/muse/widgets/doublelabel.cpp2
-rw-r--r--muse2/muse/widgets/mtrackinfo.cpp28
-rw-r--r--muse2/muse/widgets/mtrackinfobase.ui115
-rw-r--r--muse2/muse/widgets/mtscale.cpp4
-rw-r--r--muse2/muse/widgets/mtscale_flo.cpp4
-rw-r--r--muse2/muse/widgets/musewidgetsplug.cpp18
-rw-r--r--muse2/muse/widgets/pixmap_button.cpp174
-rw-r--r--muse2/muse/widgets/pixmap_button.h87
-rw-r--r--muse2/muse/widgets/popupmenu.cpp17
-rw-r--r--muse2/muse/widgets/popupmenu.h3
-rw-r--r--muse2/muse/widgets/routepopup.cpp538
-rw-r--r--muse2/muse/widgets/routepopup.h11
37 files changed, 1346 insertions, 464 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 148f3072..4fd01bf7 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -327,7 +327,7 @@ MusE::MusE(int /*argc*/, char** /*argv*/) : QMainWindow()
mixer2 = 0;
watchdogThread = 0;
editInstrument = 0;
- routingPopupMenu = 0;
+ //routingPopupMenu = 0;
progress = 0;
activeTopWin = NULL;
currentMenuSharingTopwin = NULL;
@@ -1620,18 +1620,6 @@ void MusE::closeEvent(QCloseEvent* event)
printf("MusE: Exiting Metronome\n");
MusECore::exitMetronome();
- // Make sure to delete the menu. ~routingPopupMenu() will NOT be called automatically.
- // Even though it is a child of MusE, it just passes MusE onto the underlying PopupMenus.
- if(routingPopupMenu)
- delete routingPopupMenu;
- #if 0
- if(routingPopupView)
- {
- routingPopupView->clear();
- delete routingPopupView;
- }
- #endif
-
MusEGlobal::song->cleanupForQuit();
// Give midi devices a chance to close first, above in cleanupForQuit.
@@ -1802,18 +1790,20 @@ void MusE::showTransport(bool flag)
viewTransportAction->setChecked(flag);
}
+/*
//---------------------------------------------------------
// getRoutingPopupMenu
// Get the special common routing popup menu. Used (so far)
// by audio strip, midi strip, and midi trackinfo.
//---------------------------------------------------------
-MusEGui::RoutePopupMenu* MusE::getRoutingPopupMenu()
+MusEGui::RoutePopupMenu* MusE::()
{
if(!routingPopupMenu)
routingPopupMenu = new MusEGui::RoutePopupMenu(this);
return routingPopupMenu;
}
+*/
//---------------------------------------------------------
// saveAs
@@ -2493,7 +2483,8 @@ void MusE::changeConfig(bool writeFlag)
//loadStyleSheetFile(MusEGlobal::config.styleSheetFile);
loadTheme(MusEGlobal::config.style);
QApplication::setFont(MusEGlobal::config.fonts[0]);
- loadStyleSheetFile(MusEGlobal::config.styleSheetFile);
+ if(!MusEGlobal::config.styleSheetFile.isEmpty())
+ loadStyleSheetFile(MusEGlobal::config.styleSheetFile);
emit configChanged();
updateConfiguration();
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index 184581dc..5dad1ff5 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -85,7 +85,6 @@ class MidiSyncConfig;
class MidiTransformerDialog;
class PrinterConfig;
class RhythmGen;
-class RoutePopupMenu;
class ScoreEdit;
class ShortcutConfig;
class TopWin;
@@ -185,9 +184,6 @@ class MusE : public QMainWindow
QMenu* menu_audio, *menuAutomation, *menuUtils;
QMenu* menu_functions, *menuScriptPlugins;
- // Special common menu for routes. Used (so far) by audio and midi strip, and midi trackinfo.
- RoutePopupMenu* routingPopupMenu;
-
QMenu* follow;
QMenu* midiInputPlugins;
@@ -408,7 +404,6 @@ class MusE : public QMainWindow
bool importWaveToTrack(QString& name, unsigned tick=0, MusECore::Track* track=NULL);
void importPartToTrack(QString& filename, unsigned tick, MusECore::Track* track);
void showTransport(bool flag);
- RoutePopupMenu* getRoutingPopupMenu();
const ToplevelList* getToplevels() { return &toplevels; }
diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp
index e9ebf222..37b5726f 100644
--- a/muse2/muse/appearance.cpp
+++ b/muse2/muse/appearance.cpp
@@ -130,12 +130,12 @@ Appearance::Appearance(Arranger* a, QWidget* parent)
lastSelectedBgItem = 0;
fontName0->setToolTip(tr("Main application font, and default font for any\n controls not defined here."));
- fontName1->setToolTip(tr("For small controls like mixer strips.\nAlso timescale small numbers, arranger part name overlay,\n and effects rack."));
- fontName2->setToolTip(tr("Midi track info panel. Transport controls."));
- fontName3->setToolTip(tr("Controller graph and S/X buttons. Large numbers for time\n and tempo scale, and time signature."));
- fontName4->setToolTip(tr("Time scale markers."));
- fontName5->setToolTip(tr("List editor: meta event edit dialog multi-line edit box."));
- fontName6->setToolTip(tr("Mixer label font. Auto-font-sizing up to chosen font size.\nWord-breaking but only with spaces."));
+ fontName1->setToolTip(tr("Mixer strips and effects racks. Midi track info panel.\nMidi control panel entry box."));
+ fontName2->setToolTip(tr("Transport controls."));
+ fontName3->setToolTip(tr("Time scale upper, and time signature.\nController graph and S/X buttons."));
+ fontName4->setToolTip(tr("Time scale lower, and arranger part name overlay."));
+ fontName5->setToolTip(tr("Tempo scale, and markers."));
+ fontName6->setToolTip(tr("Mixer labels. Auto-font-sizing up to chosen font size.\nWord-breaking but only with spaces."));
fontSize6->setToolTip(tr("Maximum mixer label auto-font-sizing font size."));
globalAlphaSlider->setToolTip(tr("Global opacity (opposite of transparency)."));
diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp
index 119da498..84923f12 100644
--- a/muse2/muse/arranger/alayout.cpp
+++ b/muse2/muse/arranger/alayout.cpp
@@ -138,7 +138,8 @@ void TLLayout::setGeometry(const QRect &rect)
range = 0;
// Note this appears to cause a single recursive call to this function - jumps to beginning,
// because now the scroll bar wants to be put in the layout.
- sb->setVisible(range != 0);
+ // Moved below. p4.0.44
+ ///sb->setVisible(range != 0);
if (range)
sb->setMaximum(range);
@@ -154,6 +155,9 @@ void TLLayout::setGeometry(const QRect &rect)
li[4]->setGeometry(QRect(0, y2, w, s4.height()));
li[5]->setGeometry(QRect(3, y3, s5.width(), s5.height()));
+ /// Fix for non-appearing scrollbar. Yes, we must allow the recursive call, but try it here, not above. p4.0.44 Tim
+ sb->setVisible(range != 0);
+
//_inSetGeometry = false;
}
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
index cb024070..af5c9785 100644
--- a/muse2/muse/arranger/arranger.cpp
+++ b/muse2/muse/arranger/arranger.cpp
@@ -1032,12 +1032,13 @@ void Arranger::genTrackInfo(QWidget* parent)
noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
midiTrackInfo = new MidiTrackInfo(trackInfo);
+
//midiTrackInfo->setFocusPolicy(Qt::TabFocus); // p4.0.9
//midiTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
trackInfo->addWidget(noTrackInfo, 0);
trackInfo->addWidget(midiTrackInfo, 1);
trackInfo->addWidget(0, 2);
-
+
/// genMidiTrackInfo();
}
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index f190de3b..05b7b12a 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1763,7 +1763,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
//bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving();
bool rev = brightness >= 12000 && !part->selected();
p.save();
- p.setFont(MusEGlobal::config.fonts[1]);
+ p.setFont(MusEGlobal::config.fonts[4]);
p.setWorldMatrixEnabled(false);
if (rev)
p.setPen(Qt::white);
@@ -2256,7 +2256,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
brightness = part_r*29 + part_g*59 + part_b*12;
//bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving();
bool rev = brightness >= 12000 && !part->selected();
- p.setFont(MusEGlobal::config.fonts[1]);
+ p.setFont(MusEGlobal::config.fonts[4]);
if (rev)
p.setPen(Qt::white);
else
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 620a24b7..4fc39c2c 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -585,10 +585,6 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y)
switch(t->type()) {
case MusECore::Track::MIDI:
case MusECore::Track::DRUM:
- // FINDMICHJETZT: this is a notice for flo's experimental
- // branch! don't forget NEW_DRUM here!
- // please don't remove this. i'll do it when
- // the time is there.
case MusECore::Track::AUDIO_SOFTSYNTH:
{
MusECore::MidiTrack* track = (MusECore::MidiTrack*)t;
@@ -1136,10 +1132,11 @@ void TList::changeAutomationColor(QAction* act)
// colorMenu
//---------------------------------------------------------
//QMenu* TList::colorMenu(QColor c, int id)
-PopupMenu* TList::colorMenu(QColor c, int id)
+PopupMenu* TList::colorMenu(QColor c, int id, QWidget* parent)
{
//QMenu * m = new QMenu(this);
- PopupMenu * m = new PopupMenu(this); //, true); TODO
+ //PopupMenu * m = new PopupMenu(this); //, true); TODO
+ PopupMenu * m = new PopupMenu(parent); //, true); //
for (int i = 0; i< 6; i++) {
QPixmap pix(10,10);
QPainter p(&pix);
@@ -1301,7 +1298,8 @@ void TList::mousePressEvent(QMouseEvent* ev)
data += 150; // illegal color > 100
act->setData(data);
//QMenu *m = colorMenu(cl->color(), cl->id());
- PopupMenu *m = colorMenu(cl->color(), cl->id());
+ //PopupMenu *m = colorMenu(cl->color(), cl->id());
+ PopupMenu *m = colorMenu(cl->color(), cl->id(), p);
act->setMenu(m);
}
connect(p, SIGNAL(triggered(QAction*)), SLOT(changeAutomation(QAction*)));
diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h
index 2aeae939..5ae3fbe9 100644
--- a/muse2/muse/arranger/tlist.h
+++ b/muse2/muse/arranger/tlist.h
@@ -27,6 +27,7 @@
#include <QWidget>
+class QWidget;
class QKeyEvent;
class QLineEdit;
class QSpinBox;
@@ -109,7 +110,7 @@ class TList : public QWidget {
MusECore::TrackList getRecEnabledTracks();
void setHeaderToolTips();
//QMenu* colorMenu(QColor c, int id);
- PopupMenu* colorMenu(QColor c, int id);
+ PopupMenu* colorMenu(QColor c, int id, QWidget* parent);
private slots:
void returnPressed();
diff --git a/muse2/muse/driver/alsamidi.cpp b/muse2/muse/driver/alsamidi.cpp
index 4687f17f..2c6f9468 100644
--- a/muse2/muse/driver/alsamidi.cpp
+++ b/muse2/muse/driver/alsamidi.cpp
@@ -79,6 +79,16 @@ int MidiAlsaDevice::selectWfd()
QString MidiAlsaDevice::open()
{
_openFlags &= _rwFlags; // restrict to available bits
+
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_info_alloca(&pinfo);
+ int rv = snd_seq_get_any_port_info(alsaSeq, adr.client, adr.port, pinfo);
+ if(rv < 0)
+ {
+ printf("MidiAlsaDevice::open Error getting port info: adr: %d:%d: %s\n", adr.client, adr.port, snd_strerror(rv));
+ return QString(snd_strerror(rv));
+ }
+
snd_seq_port_subscribe_t* subs;
// Allocated on stack, no need to call snd_seq_port_subscribe_free() later.
snd_seq_port_subscribe_alloca(&subs);
@@ -87,12 +97,9 @@ QString MidiAlsaDevice::open()
int wer = 0;
int rer = 0;
- snd_seq_port_info_t *pinfo;
- snd_seq_port_info_alloca(&pinfo);
- //snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
- snd_seq_port_info_set_addr(pinfo, &adr);
-
int cap = snd_seq_port_info_get_capability(pinfo);
+
+ //printf("MidiAlsaDevice::open cap:%d\n", cap);
// subscribe for writing
if (_openFlags & 1)
@@ -151,6 +158,15 @@ QString MidiAlsaDevice::open()
void MidiAlsaDevice::close()
{
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_info_alloca(&pinfo);
+ int rv = snd_seq_get_any_port_info(alsaSeq, adr.client, adr.port, pinfo);
+ if(rv < 0)
+ {
+ printf("MidiAlsaDevice::close Error getting port info: adr: %d:%d: %s\n", adr.client, adr.port, snd_strerror(rv));
+ return;
+ }
+
snd_seq_port_subscribe_t* subs;
// Allocated on stack, no need to call snd_seq_port_subscribe_free() later.
snd_seq_port_subscribe_alloca(&subs);
@@ -158,13 +174,10 @@ void MidiAlsaDevice::close()
int wer = 0;
int rer = 0;
- snd_seq_port_info_t *pinfo;
- snd_seq_port_info_alloca(&pinfo);
- //snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
- snd_seq_port_info_set_addr(pinfo, &adr);
-
int cap = snd_seq_port_info_get_capability(pinfo);
+ //printf("MidiAlsaDevice::close cap:%d\n", cap);
+
// This function appears to be called only by MidiPort::setMidiDevice(),
// which closes then opens the device.
// Because the open flags are set BEFORE setMidiDevice() is called, we must ignore the flags.
@@ -881,10 +894,10 @@ void exitMidiAlsa()
// Allocated on stack, no need to call snd_seq_port_subscribe_free() later.
snd_seq_port_subscribe_alloca(&subs);
- snd_seq_port_info_t *pinfo;
- snd_seq_port_info_alloca(&pinfo);
+ //snd_seq_port_info_t *pinfo;
+ //snd_seq_port_info_alloca(&pinfo);
//snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
- snd_seq_port_info_set_addr(pinfo, &announce_adr);
+ //snd_seq_port_info_set_addr(pinfo, &announce_adr);
snd_seq_port_subscribe_set_dest(subs, &musePort);
snd_seq_port_subscribe_set_sender(subs, &announce_adr);
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
index 0abbbd76..f05abbf2 100644
--- a/muse2/muse/gconfig.cpp
+++ b/muse2/muse/gconfig.cpp
@@ -89,11 +89,11 @@ GlobalConfigValues config = {
QColor(200, 192, 171), // waveEditBackgroundColor;
{
QFont(QString("arial"), 10, QFont::Normal),
- QFont(QString("arial"), 8, QFont::Normal),
+ QFont(QString("arial"), 7, QFont::Normal), // Mixer strips and midi track info panel
QFont(QString("arial"), 10, QFont::Normal),
QFont(QString("arial"), 10, QFont::Bold),
- QFont(QString("arial"), 8, QFont::Bold), // timescale numbers
- QFont(QString("Lucidatypewriter"), 14, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Normal), // Small numbers: Timescale and markers, part name overlay
+ QFont(QString("arial"), 8, QFont::Bold), // Small bold numbers such as marker text
QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone,
// at the price of only few more pixels than Normal mode.
},
@@ -161,16 +161,15 @@ GlobalConfigValues config = {
false, // BigTimeVisible;
false, // mixer1Visible;
false, // mixer2Visible;
-
false, // markerVisible;
- true, // arrangerVisible;
+ true, // arrangerVisible;
true, // showSplashScreen
1, // canvasShowPartType 1 - names, 2 events
5, // canvasShowPartEvent
- true, // canvasShowGrid;
+ true, // canvasShowGrid;
QString(""), // canvasBgPixmap;
QStringList(), // canvasCustomBgList
- QString(":/style.qss"), // default styleSheetFile
+ QString(""), // default styleSheetFile - For built-in set to ":/style.qss"
QString(""), // style
QString("sweep"), // externalWavEditor
false, // useOldStyleStopShortCut
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp
index f560fbfb..b1f37e36 100644
--- a/muse2/muse/helper.cpp
+++ b/muse2/muse/helper.cpp
@@ -398,9 +398,10 @@ QString getUniqueUntitledName()
// -------------------------------------------------------------------------------------------------------
// populateMidiPorts()
-// This version creats separate devices for input and output ports.
+// This version creats separate devices for Jack midi input and outputs.
// It does not attempt to pair them together.
// -------------------------------------------------------------------------------------------------------
+
void populateMidiPorts()
{
if(!MusEGlobal::checkAudioDevice())
@@ -409,6 +410,8 @@ void populateMidiPorts()
MusECore::MidiDevice* dev = 0;
int port_num = 0;
+
+ int jack_midis_found = 0;
// If Jack is running, prefer Jack midi devices over ALSA.
if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::JACK_AUDIO)
@@ -420,6 +423,7 @@ void populateMidiPorts()
dev = MusECore::MidiJackDevice::createJackMidiDevice(*i, 1);
if(dev)
{
+ ++jack_midis_found;
//printf("populateMidiPorts Created jack writeable device: %s\n", dev->name().toLatin1().constData());
//dev->setOpenFlags(1);
MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[port_num], dev);
@@ -437,6 +441,7 @@ void populateMidiPorts()
dev = MusECore::MidiJackDevice::createJackMidiDevice(*i, 2);
if(dev)
{
+ ++jack_midis_found;
//printf("populateMidiPorts Created jack readable device: %s\n", dev->name().toLatin1().constData());
//dev->setOpenFlags(2);
MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[port_num], dev);
@@ -448,9 +453,13 @@ void populateMidiPorts()
}
}
}
- else
+ //else
// If Jack is not running, use ALSA devices.
- if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO)
+ //if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO)
+ // Try to do the user a favour: If we still have no Jack devices, even if Jack is running, fill with ALSA.
+ // It is possible user has Jack running on ALSA back-end but without midi support.
+ // IE. They use Jack for audio but use ALSA for midi!
+ if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO || jack_midis_found == 0)
{
for(MusECore::iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i)
{
diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp
index 6991eab8..1cf28259 100644
--- a/muse2/muse/icons.cpp
+++ b/muse2/muse/icons.cpp
@@ -43,8 +43,8 @@
#include "xpm/midi_inputplugins_random_rhythm_generator.xpm"
#include "xpm/midi_local_off.xpm"
#include "xpm/midi_reset_instr.xpm"
-#include "xpm/midi_thru_off3.xpm"
-#include "xpm/midi_thru_on3.xpm"
+#include "xpm/midi_thru_off4.xpm"
+#include "xpm/midi_thru_on4.xpm"
#include "xpm/settings_appearance_settings.xpm"
#include "xpm/settings_configureshortcuts.xpm"
#include "xpm/settings_follow_song.xpm"
@@ -119,6 +119,10 @@
#include "xpm/mutebutton_off.xpm"
#include "xpm/rec_echo_on.xpm"
#include "xpm/rec_echo_off.xpm"
+#include "xpm/routing_input_button_slim_4.xpm"
+#include "xpm/routing_output_button_slim_4.xpm"
+#include "xpm/routing_midi_input_button_slim.xpm"
+#include "xpm/routing_midi_output_button_slim.xpm"
#include "xpm/up.xpm"
#include "xpm/down.xpm"
@@ -174,6 +178,7 @@
#include "xpm/exit.xpm"
#include "xpm/exit1.xpm"
+#include "xpm/toggle_small.xpm"
#include "xpm/redled.xpm"
#include "xpm/darkredled.xpm"
#include "xpm/greendot.xpm"
@@ -239,6 +244,7 @@
#include "xpm/sine.xpm"
#include "xpm/saw.xpm"
+#include "icons.h"
#if QT_VERSION >= 0x040600
#define MPIXMAP(a,b) QPixmap(QIcon::fromTheme(b, QIcon(QPixmap(a))).pixmap(QPixmap(a).width(),QPixmap(a).height()))
@@ -284,6 +290,11 @@ QPixmap* exit1Icon;
QPixmap* newmuteIcon;
QPixmap* soloIcon;
+QPixmap* routesInIcon;
+QPixmap* routesOutIcon;
+QPixmap* routesMidiInIcon;
+QPixmap* routesMidiOutIcon;
+
QPixmap* pointerIcon;
QPixmap* pencilIcon;
QPixmap* deleteIcon;
@@ -396,6 +407,7 @@ QIcon* editpaste2TrackIcon;
QIcon* editpasteClone2TrackIcon;
*/
+QPixmap* toggle_small_Icon;
QPixmap* redLedIcon;
QPixmap* darkRedLedIcon;
QPixmap* greendotIcon;
@@ -595,6 +607,11 @@ void initIcons()
newmuteIcon = new MPIXMAP(newmutebutton_xpm, NULL);
soloIcon = new MPIXMAP(solobutton_xpm, NULL);
+ routesInIcon = new MPIXMAP(routing_input_button_slim_4_xpm, NULL);
+ routesOutIcon = new MPIXMAP(routing_output_button_slim_4_xpm, NULL);
+ routesMidiInIcon = new MPIXMAP(routing_midi_input_button_slim_xpm, NULL);
+ routesMidiOutIcon = new MPIXMAP(routing_midi_output_button_slim_xpm, NULL);
+
recEchoIconOn = new MPIXMAP(rec_echo_on_xpm, NULL);
recEchoIconOff = new MPIXMAP(rec_echo_off_xpm, NULL);
muteIconOn = new MPIXMAP(mutebutton_on_xpm, NULL);
@@ -610,6 +627,7 @@ void initIcons()
//soloIconSet2->addPixmap(*soloblksqIconOn, QIcon::Normal, QIcon::On);
//soloIconSet2->addPixmap(*soloblksqIconOff, QIcon::Normal, QIcon::Off);
+ toggle_small_Icon = new MPIXMAP(toggle_small_xpm, NULL);
redLedIcon = new MPIXMAP(redled_xpm, NULL);
darkRedLedIcon = new MPIXMAP(darkredled_xpm, NULL);
greendotIcon = new MPIXMAP(greendot_xpm, NULL);
@@ -625,8 +643,8 @@ void initIcons()
miditransformSIcon = new MPIXMAP(miditransformS_xpm, NULL);
midi_plugSIcon = new MPIXMAP(midi_plugS_xpm, NULL);
miditransposeSIcon = new MPIXMAP(miditransposeS_xpm, NULL);
- midiThruOnIcon = new MPIXMAP(midi_thru_on3_xpm, NULL);
- midiThruOffIcon = new MPIXMAP(midi_thru_off3_xpm, NULL);
+ midiThruOnIcon = new MPIXMAP(midi_thru_on4_xpm, NULL);
+ midiThruOffIcon = new MPIXMAP(midi_thru_off4_xpm, NULL);
mixerSIcon = new MPIXMAP(mixerS_xpm, NULL);
mustangSIcon = new MPIXMAP(mustangS_xpm, NULL);
diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h
index 0c576ba4..8d55882b 100644
--- a/muse2/muse/icons.h
+++ b/muse2/muse/icons.h
@@ -147,6 +147,10 @@ extern QPixmap* record_off_Icon;
extern QPixmap* newmuteIcon;
extern QPixmap* soloIcon;
+extern QPixmap* routesInIcon;
+extern QPixmap* routesOutIcon;
+extern QPixmap* routesMidiInIcon;
+extern QPixmap* routesMidiOutIcon;
extern QPixmap* muteIconOn;
extern QPixmap* muteIconOff;
extern QPixmap* soloIconOn;
@@ -156,6 +160,7 @@ extern QPixmap* soloblksqIconOff;
//extern QIcon* soloIconSet1;
//extern QIcon* soloIconSet2;
+extern QPixmap* toggle_small_Icon;
extern QPixmap* redLedIcon;
extern QPixmap* darkRedLedIcon;
extern QPixmap* greendotIcon;
diff --git a/muse2/muse/ladspa.h b/muse2/muse/ladspa.h
index 7bbc338f..d7e0e902 100644
--- a/muse2/muse/ladspa.h
+++ b/muse2/muse/ladspa.h
@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef LADSPA_INCLUDED
diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp
index 214f74c2..fa58bafd 100644
--- a/muse2/muse/liste/editevent.cpp
+++ b/muse2/muse/liste/editevent.cpp
@@ -330,7 +330,7 @@ EditMetaDialog::EditMetaDialog(int tick, const MusECore::Event& ev,
connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool)));
edit = new QTextEdit;
- edit->setFont(MusEGlobal::config.fonts[5]);
+ edit->setFont(MusEGlobal::config.fonts[0]);
if (!ev.empty()) {
epos->setValue(tick);
diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp
index 23e7337b..57bb898d 100644
--- a/muse2/muse/master/tscale.cpp
+++ b/muse2/muse/master/tscale.cpp
@@ -37,7 +37,7 @@ namespace MusEGui {
TScale::TScale(QWidget* parent, int ymag)
: View(parent, 1, ymag)
{
- setFont(MusEGlobal::config.fonts[4]);
+ setFont(MusEGlobal::config.fonts[5]);
//int w = 4 * QFontMetrics(MusEGlobal::config.fonts[4]).width('0');
int w = 4 * fontMetrics().width('0');
setFixedWidth(w);
diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp
index 439a92b9..25171450 100644
--- a/muse2/muse/mixer/amixer.cpp
+++ b/muse2/muse/mixer/amixer.cpp
@@ -538,7 +538,7 @@ void AudioMixerApp::updateMixer(UpdateAction action)
void AudioMixerApp::configChanged()
{
- songChanged(SC_CONFIG);
+ songChanged(-1); // Catch when fonts change, do full rebuild.
}
//---------------------------------------------------------
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index 9c393a1a..ecb2f507 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -895,7 +895,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
record->setToolTip(tr("record"));
record->setChecked(t->recordFlag());
record->setIcon(t->recordFlag() ? QIcon(*record_on_Icon) : QIcon(*record_off_Icon));
- record->setIconSize(record_on_Icon->size());
+ ///record->setIconSize(record_on_Icon->size());
connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
}
@@ -906,7 +906,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
mute->setToolTip(tr("mute"));
mute->setChecked(t->mute());
mute->setIcon(t->mute() ? QIcon(*muteIconOff) : QIcon(*muteIconOn));
- mute->setIconSize(muteIconOn->size());
+ ///mute->setIconSize(muteIconOn->size());
mute->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
@@ -918,7 +918,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
solo->setIcon(t->solo() ? QIcon(*soloblksqIconOn) : QIcon(*soloblksqIconOff));
else
solo->setIcon(t->solo() ? QIcon(*soloIconOn) : QIcon(*soloIconOff));
- solo->setIconSize(soloIconOn->size());
+ ///solo->setIconSize(soloIconOn->size());
solo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
if (type == MusECore::Track::AUDIO_OUTPUT) {
@@ -938,7 +938,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
off->setToolTip(tr("off"));
off->setChecked(t->off());
off->setIcon(t->off() ? QIcon(*exit1Icon) : QIcon(*exitIcon));
- off->setIconSize(exit1Icon->size());
+ ///off->setIconSize(exit1Icon->size());
connect(off, SIGNAL(clicked(bool)), SLOT(offToggled(bool)));
grid->addWidget(off, _curGridRow, 0);
@@ -955,8 +955,10 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
if (type != MusECore::Track::AUDIO_AUX) {
iR = new QToolButton();
iR->setFont(MusEGlobal::config.fonts[1]);
- iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
- iR->setText(tr("iR"));
+ iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
+ ///iR->setText(tr("iR"));
+ iR->setIcon(QIcon(*routesInIcon));
+ iR->setIconSize(routesInIcon->size());
iR->setCheckable(false);
iR->setToolTip(tr("input routing"));
grid->addWidget(iR, _curGridRow, 0);
@@ -965,8 +967,10 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
oR = new QToolButton();
oR->setFont(MusEGlobal::config.fonts[1]);
- oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
- oR->setText(tr("oR"));
+ oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
+ ///oR->setText(tr("oR"));
+ oR->setIcon(QIcon(*routesOutIcon));
+ oR->setIconSize(routesOutIcon->size());
oR->setCheckable(false);
oR->setToolTip(tr("output routing"));
grid->addWidget(oR, _curGridRow++, 1);
@@ -1045,9 +1049,11 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at)
void AudioStrip::iRoutePressed()
{
- MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- iR->setDown(false);
+ //MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), track, false);
+ delete pup;
+ iR->setDown(false);
}
//---------------------------------------------------------
@@ -1056,9 +1062,11 @@ void AudioStrip::iRoutePressed()
void AudioStrip::oRoutePressed()
{
- MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- oR->setDown(false);
+ //MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), track, true);
+ delete pup;
+ oR->setDown(false);
}
} // namespace MusEGui
diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp
index dc495aa6..031eaa4b 100644
--- a/muse2/muse/mixer/mstrip.cpp
+++ b/muse2/muse/mixer/mstrip.cpp
@@ -300,7 +300,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t)
record->setToolTip(tr("record"));
record->setChecked(track->recordFlag());
record->setIcon(track->recordFlag() ? QIcon(*record_on_Icon) : QIcon(*record_off_Icon));
- record->setIconSize(record_on_Icon->size());
+ ///record->setIconSize(record_on_Icon->size());
connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
mute = new QToolButton();
@@ -308,7 +308,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t)
mute->setToolTip(tr("mute"));
mute->setChecked(track->mute());
mute->setIcon(track->mute() ? QIcon(*muteIconOff) : QIcon(*muteIconOn));
- mute->setIconSize(muteIconOn->size());
+ ///mute->setIconSize(muteIconOn->size());
mute->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
@@ -322,7 +322,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t)
solo->setIcon(track->solo() ? QIcon(*soloblksqIconOn) : QIcon(*soloblksqIconOff));
else
solo->setIcon(track->solo() ? QIcon(*soloIconOn) : QIcon(*soloIconOff));
- solo->setIconSize(soloIconOn->size());
+ ///solo->setIconSize(soloIconOn->size());
connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
/*
@@ -368,7 +368,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t)
off->setToolTip(tr("off"));
off->setChecked(track->off());
off->setIcon(track->off() ? QIcon(*exit1Icon) : QIcon(*exitIcon));
- off->setIconSize(exit1Icon->size());
+ ///off->setIconSize(exit1Icon->size());
connect(off, SIGNAL(clicked(bool)), SLOT(offToggled(bool)));
grid->addWidget(off, _curGridRow, 0);
@@ -382,16 +382,20 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t)
iR = new QToolButton();
iR->setFont(MusEGlobal::config.fonts[1]);
- iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
- iR->setText(tr("iR"));
+ iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
+ ///iR->setText(tr("iR"));
+ iR->setIcon(QIcon(*routesMidiInIcon));
+ iR->setIconSize(routesMidiInIcon->size());
iR->setCheckable(false);
iR->setToolTip(tr("input routing"));
grid->addWidget(iR, _curGridRow, 0);
connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
oR = new QToolButton();
oR->setFont(MusEGlobal::config.fonts[1]);
- oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
- oR->setText(tr("oR"));
+ oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
+ ///oR->setText(tr("oR"));
+ oR->setIcon(QIcon(*routesMidiOutIcon));
+ oR->setIconSize(routesMidiOutIcon->size());
oR->setCheckable(false);
// TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
// Enabled (for Midi Port to Audio Input routing). p4.0.14 Tim.
@@ -994,9 +998,11 @@ void MidiStrip::setReverbSend(double val)
void MidiStrip::iRoutePressed()
{
- MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- iR->setDown(false);
+ //MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), track, false);
+ delete pup;
+ iR->setDown(false);
}
//---------------------------------------------------------
@@ -1005,9 +1011,11 @@ void MidiStrip::iRoutePressed()
void MidiStrip::oRoutePressed()
{
- MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- oR->setDown(false);
+ //MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), track, true);
+ delete pup;
+ oR->setDown(false);
}
} // namespace MusEGui
diff --git a/muse2/muse/node.cpp b/muse2/muse/node.cpp
index cb77f939..b6b40738 100644
--- a/muse2/muse/node.cpp
+++ b/muse2/muse/node.cpp
@@ -687,7 +687,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s
for(int c = 0; c < dstChannels; ++c)
{
double v;
- if(srcStartChan > 2) // Don't apply pan or volume to extra channels above 2.
+ if(srcStartChan > 2 || _prefader) // Don't apply pan or volume to extra channels above 2. Or if prefader on.
//v = _volume;
v = 1.0;
else
@@ -711,7 +711,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s
for(int c = 0; c < dstChannels; ++c)
{
double v;
- if(srcStartChan > 2) // Don't apply pan or volume to extra channels above 2.
+ if(srcStartChan > 2 || _prefader) // Don't apply pan or volume to extra channels above 2. Or if prefader on.
//v = _volume;
v = 1.0;
else
@@ -729,10 +729,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s
}
else if(srcChans == 2 && dstChannels == 1)
{
- //double v1 = (srcStartChan > 2 ? _volume : vol[srcStartChan]); // Don't apply pan to extra channels above 2.
+ //double v1 = (srcStartChan > 2 ? _volume : vol[srcStartChan]); //
//double v2 = (srcStartChan > 2 ? _volume : vol[srcStartChan + 1]); //
- double v1 = (srcStartChan > 2 ? 1.0 : vol[srcStartChan]); // Don't apply pan or volume to extra channels above 2.
- double v2 = (srcStartChan > 2 ? 1.0 : vol[srcStartChan + 1]); //
+ double v1 = ((srcStartChan > 2 || _prefader) ? 1.0 : vol[srcStartChan]); // Don't apply pan or volume to extra channels above 2. Or if prefader on.
+ double v2 = ((srcStartChan > 2 || _prefader) ? 1.0 : vol[srcStartChan + 1]); //
float* dp = dstBuffer[0];
float* sp1 = buffer[srcStartChan];
float* sp2 = buffer[srcStartChan + 1];
@@ -1034,7 +1034,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr
for(int c = 0; c < dstChannels; ++c)
{
double v;
- if(srcStartChan > 2) // Don't apply pan or volume to extra channels above 2.
+ if(srcStartChan > 2 || _prefader) // Don't apply pan or volume to extra channels above 2. Or if prefader on.
//v = _volume;
v = 1.0;
else
@@ -1058,7 +1058,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr
for(int c = 0; c < dstChannels; ++c)
{
double v;
- if(srcStartChan > 2) // Don't apply pan or volume to extra channels above 2.
+ if(srcStartChan > 2 || _prefader) // Don't apply pan or volume to extra channels above 2. Or if prefader on.
//v = _volume;
v = 1.0;
else
@@ -1078,8 +1078,8 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr
{
//double v1 = (srcStartChan > 2 ? _volume : vol[srcStartChan]); // Don't apply pan to extra channels above 2.
//double v2 = (srcStartChan > 2 ? _volume : vol[srcStartChan + 1]); //
- double v1 = (srcStartChan > 2 ? 1.0 : vol[srcStartChan]); // Don't apply pan or volume to extra channels above 2.
- double v2 = (srcStartChan > 2 ? 1.0 : vol[srcStartChan + 1]); //
+ double v1 = ((srcStartChan > 2 || _prefader) ? 1.0 : vol[srcStartChan]); // Don't apply pan or volume to extra channels above 2. Or if prefader on.
+ double v2 = ((srcStartChan > 2 || _prefader) ? 1.0 : vol[srcStartChan + 1]); //
float* sp1 = buffer[srcStartChan];
float* sp2 = buffer[srcStartChan + 1];
float* dp = dstBuffer[0];
@@ -1095,7 +1095,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr
void AudioTrack::readVolume(Xml& xml)
{
- int ch = 0;
+ //int ch = 0;
for (;;) {
Xml::Token token = xml.parse();
switch (token) {
@@ -1110,7 +1110,8 @@ void AudioTrack::readVolume(Xml& xml)
break;
case Xml::Attribut:
if (xml.s1() == "ch")
- ch = xml.s2().toInt();
+ //ch = xml.s2().toInt();
+ xml.s2();
break;
case Xml::TagEnd:
if (xml.s1() == "volume")
diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp
index 227a9daf..e7e5c1f8 100644
--- a/muse2/muse/plugin.cpp
+++ b/muse2/muse/plugin.cpp
@@ -37,6 +37,7 @@
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
+#include <QHeaderView>
#include <QLabel>
#include <QMainWindow>
#include <QMessageBox>
@@ -45,13 +46,13 @@
#include <QSignalMapper>
#include <QSizePolicy>
#include <QScrollArea>
+#include <QSpacerItem>
#include <QTimer>
#include <QToolBar>
#include <QToolButton>
#include <QTreeWidget>
#include <QVBoxLayout>
#include <QWhatsThis>
-#include <QHeaderView>
#include "globals.h"
#include "globaldefs.h"
@@ -100,7 +101,10 @@ static const char* MusEGlobal::preset_file_save_pattern[] = {
namespace MusEGui {
int PluginDialog::selectedPlugType = 0;
QStringList PluginDialog::sortItems = QStringList();
-
+///int PluginDialog::sortColumn = 0;
+///Qt::SortOrder PluginDialog::sortOrder = Qt::AscendingOrder;
+QRect PluginDialog::geometrySave = QRect();
+QByteArray PluginDialog::listSave = QByteArray();
}
namespace MusECore {
@@ -3145,11 +3149,18 @@ PluginDialog::PluginDialog(QWidget* parent)
: QDialog(parent)
{
setWindowTitle(tr("MusE: select plugin"));
+
+ if(!geometrySave.isNull())
+ setGeometry(geometrySave);
+
QVBoxLayout* layout = new QVBoxLayout(this);
pList = new QTreeWidget(this);
pList->setColumnCount(11);
- pList->setSortingEnabled(true);
+ // "Note: In order to avoid performance issues, it is recommended that sorting
+ // is enabled after inserting the items into the tree. Alternatively, you could
+ // also insert the items into a list before inserting the items into the tree. "
+ //pList->setSortingEnabled(true);
QStringList headerLabels;
headerLabels << tr("Lib");
headerLabels << tr("Label");
@@ -3163,25 +3174,17 @@ PluginDialog::PluginDialog(QWidget* parent)
headerLabels << tr("Maker");
headerLabels << tr("Copyright");
- int sizes[] = { 110, 110, 0, 30, 30, 30, 30, 30, 40, 110, 110 };
- for (int i = 0; i < 11; ++i) {
- if (sizes[i] == 0) {
- pList->header()->setResizeMode(i, QHeaderView::Stretch);
- }
- else {
- if (sizes[i] <= 40) // hack alert!
- pList->header()->setResizeMode(i, QHeaderView::Custom);
- pList->header()->resizeSection(i, sizes[i]);
- }
- }
-
pList->setHeaderLabels(headerLabels);
pList->setSelectionBehavior(QAbstractItemView::SelectRows);
pList->setSelectionMode(QAbstractItemView::SingleSelection);
pList->setAlternatingRowColors(true);
-
- fillPlugs(selectedPlugType);
+ pList->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+ //fillPlugs(selectedPlugType);
+ //pList->setSortingEnabled(true);
+ //pList->sortByColumn(sortColumn, sortOrder);
+
layout->addWidget(pList);
//---------------------------------------------------
@@ -3191,42 +3194,56 @@ PluginDialog::PluginDialog(QWidget* parent)
QBoxLayout* w5 = new QHBoxLayout;
layout->addLayout(w5);
+ QBoxLayout* ok_lo = new QVBoxLayout;
+ w5->addLayout(ok_lo);
+
okB = new QPushButton(tr("Ok"), this);
okB->setDefault(true);
QPushButton* cancelB = new QPushButton(tr("Cancel"), this);
okB->setFixedWidth(80);
okB->setEnabled(false);
cancelB->setFixedWidth(80);
- w5->addWidget(okB);
- w5->addSpacing(12);
- w5->addWidget(cancelB);
-
- QGroupBox* plugSelGroup = new QGroupBox;
+ //ok_lo->addStretch(4);
+ //ok_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
+ ok_lo->addWidget(okB);
+ ok_lo->addSpacing(8);
+ ok_lo->addWidget(cancelB);
+ //ok_lo->addStretch(4);
+ //ok_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
+
+ QGroupBox* plugSelGroup = new QGroupBox(this);
plugSelGroup->setTitle("Show plugs:");
- QHBoxLayout* psl = new QHBoxLayout;
+ plugSelGroup->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+ //QHBoxLayout* psl = new QHBoxLayout;
+ QGridLayout* psl = new QGridLayout;
+ //psl->setRowStretch(0, 0);
plugSelGroup->setLayout(psl);
QButtonGroup* plugSel = new QButtonGroup(plugSelGroup);
- onlySM = new QRadioButton;
+ onlySM = new QRadioButton(this);
onlySM->setText(tr("Mono and Stereo"));
onlySM->setCheckable(true);
plugSel->addButton(onlySM);
- psl->addWidget(onlySM);
- onlyS = new QRadioButton;
+ //psl->addWidget(onlySM);
+ psl->addWidget(onlySM, 1, 0);
+ onlyS = new QRadioButton(this);
onlyS->setText(tr("Stereo"));
onlyS->setCheckable(true);
plugSel->addButton(onlyS);
- psl->addWidget(onlyS);
- onlyM = new QRadioButton;
+ //psl->addWidget(onlyS);
+ psl->addWidget(onlyS, 0, 1);
+ onlyM = new QRadioButton(this);
onlyM->setText(tr("Mono"));
onlyM->setCheckable(true);
plugSel->addButton(onlyM);
- psl->addWidget(onlyM);
- allPlug = new QRadioButton;
+ //psl->addWidget(onlyM);
+ psl->addWidget(onlyM, 0, 0);
+ allPlug = new QRadioButton(this);
allPlug->setText(tr("Show All"));
allPlug->setCheckable(true);
plugSel->addButton(allPlug);
- psl->addWidget(allPlug);
+ //psl->addWidget(allPlug);
+ psl->addWidget(allPlug, 1, 1);
plugSel->setExclusive(true);
switch(selectedPlugType) {
@@ -3240,14 +3257,18 @@ PluginDialog::PluginDialog(QWidget* parent)
"Note that using mono plugins on stereo tracks is not a problem, two will be used in parallell.<br>"
"Also beware that the 'all' alternative includes plugins that probably not are usable by MusE."));
- w5->addSpacing(12);
+ w5->addSpacing(8);
w5->addWidget(plugSelGroup);
- w5->addSpacing(12);
+ w5->addSpacing(8);
- QLabel *sortLabel = new QLabel;
+ QBoxLayout* srch_lo = new QVBoxLayout;
+ w5->addLayout(srch_lo);
+
+ QLabel *sortLabel = new QLabel(this);
sortLabel->setText(tr("Search in 'Label' and 'Name':"));
- w5->addWidget(sortLabel);
- w5->addSpacing(2);
+ srch_lo->addSpacing(8);
+ srch_lo->addWidget(sortLabel);
+ srch_lo->addSpacing(8);
sortBox = new QComboBox(this);
sortBox->setEditable(true);
@@ -3255,20 +3276,41 @@ PluginDialog::PluginDialog(QWidget* parent)
sortBox->addItems(sortItems);
sortBox->setMinimumSize(100, 10);
- w5->addWidget(sortBox);
- w5->addStretch(-1);
+ srch_lo->addWidget(sortBox);
+ //srch_lo->addStretch();
+ // FIXME: Adding this makes the whole bottom hlayout expand. Would like some space between lineedit and bottom.
+ // Same thing if spacers added to group box or Ok Cancel box.
+ //srch_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
- if (!sortBox->currentText().isEmpty())
- fillPlugs(sortBox->currentText());
+ fillPlugs();
+
+ pList->setSortingEnabled(true);
+
+ if(listSave.isEmpty())
+ {
+ //int sizes[] = { 110, 110, 0, 30, 30, 30, 30, 30, 50, 110, 110 };
+ int sizes[] = { 110, 110, 110, 30, 30, 30, 30, 30, 50, 110, 110 };
+ for (int i = 0; i < 11; ++i) {
+ //if (sizes[i] == 0) {
+ // pList->header()->setResizeMode(i, QHeaderView::Stretch);
+ // }
+ //else {
+ if (sizes[i] <= 50) // hack alert!
+ pList->header()->setResizeMode(i, QHeaderView::Fixed);
+ pList->header()->resizeSection(i, sizes[i]);
+ // }
+ }
+ pList->sortByColumn(0, Qt::AscendingOrder);
+ }
else
- fillPlugs(selectedPlugType);
+ pList->header()->restoreState(listSave);
connect(pList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(accept()));
connect(pList, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(enableOkB()));
connect(cancelB, SIGNAL(clicked()), SLOT(reject()));
connect(okB, SIGNAL(clicked()), SLOT(accept()));
connect(plugSel, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(fillPlugs(QAbstractButton*)));
- connect(sortBox, SIGNAL(editTextChanged(const QString&)),SLOT(fillPlugs(const QString&)));
+ connect(sortBox, SIGNAL(editTextChanged(const QString&)),SLOT(fillPlugs()));
sortBox->setFocus();
}
@@ -3295,39 +3337,74 @@ MusECore::Plugin* PluginDialog::value()
}
//---------------------------------------------------------
+// saveSettings
+//---------------------------------------------------------
+
+void PluginDialog::saveSettings()
+{
+ if (!sortBox->currentText().isEmpty()) {
+ bool found = false;
+ foreach (QString item, sortItems)
+ if(item == sortBox->currentText()) {
+ found = true;
+ break;
+ }
+ if(!found)
+ sortItems.push_front(sortBox->currentText());
+ }
+
+ ///sortColumn = pList->sortColumn();
+ QHeaderView* hdr = pList->header();
+ if(hdr)
+ {
+ ///sortOrder = hdr->sortIndicatorOrder();
+ listSave = hdr->saveState();
+ }
+ geometrySave = geometry();
+}
+
+//---------------------------------------------------------
// accept
//---------------------------------------------------------
void PluginDialog::accept()
{
- if (!sortBox->currentText().isEmpty()) {
- foreach (QString item, sortItems)
- if(item == sortBox->currentText()) {
- QDialog::accept();
- return;
- }
- sortItems.push_front(sortBox->currentText());
- }
+ saveSettings();
QDialog::accept();
}
//---------------------------------------------------------
+// reject
+//---------------------------------------------------------
+
+void PluginDialog::reject()
+{
+ saveSettings();
+ QDialog::reject();
+}
+
+//---------------------------------------------------------
// fillPlugs
//---------------------------------------------------------
void PluginDialog::fillPlugs(QAbstractButton* ab)
{
if (ab == allPlug)
- fillPlugs(SEL_ALL);
+ //fillPlugs(SEL_ALL);
+ selectedPlugType = SEL_ALL;
else if (ab == onlyM)
- fillPlugs(SEL_M);
+ //fillPlugs(SEL_M);
+ selectedPlugType = SEL_M;
else if (ab == onlyS)
- fillPlugs(SEL_S);
+ //fillPlugs(SEL_S);
+ selectedPlugType = SEL_S;
else if (ab == onlySM)
- fillPlugs(SEL_SM);
+ //fillPlugs(SEL_SM);
+ selectedPlugType = SEL_SM;
+ fillPlugs();
}
-void PluginDialog::fillPlugs(int nbr)
+void PluginDialog::fillPlugs()
{
pList->clear();
for (MusECore::iPlugin i = MusEGlobal::plugins.begin(); i != MusEGlobal::plugins.end(); ++i) {
@@ -3339,8 +3416,13 @@ void PluginDialog::fillPlugs(int nbr)
unsigned long ao = i->outports();
unsigned long ci = i->controlInPorts();
unsigned long co = i->controlOutPorts();
+ bool found = false;
+ QString sb_txt = sortBox->currentText().toLower();
+ if(sb_txt.isEmpty() || i->label().toLower().contains(sb_txt) || i->name().toLower().contains(sb_txt))
+ found = true;
+
bool addFlag = false;
- switch (nbr) {
+ switch (selectedPlugType) {
case SEL_SM: // stereo & mono
if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2)) {
addFlag = true;
@@ -3360,45 +3442,7 @@ void PluginDialog::fillPlugs(int nbr)
addFlag = true;
break;
}
- if (addFlag) {
- QTreeWidgetItem* item = new QTreeWidgetItem;
- item->setText(0, i->lib());
- item->setText(1, i->label());
- item->setText(2, i->name());
- item->setText(3, QString().setNum(ai));
- item->setText(4, QString().setNum(ao));
- item->setText(5, QString().setNum(ci));
- item->setText(6, QString().setNum(co));
- item->setText(7, QString().setNum(i->inPlaceCapable()));
- item->setText(8, QString().setNum(i->id()));
- item->setText(9, i->maker());
- item->setText(10, i->copyright());
- pList->addTopLevelItem(item);
- }
- }
- selectedPlugType = nbr;
-}
-
-void PluginDialog::fillPlugs(const QString &sortValue)
-{
- pList->clear();
- for (MusECore::iPlugin i = MusEGlobal::plugins.begin(); i != MusEGlobal::plugins.end(); ++i) {
- //int ai = i->inports();
- //int ao = i->outports();
- //int ci = i->controlInPorts();
- //int co = i->controlOutPorts();
- unsigned long ai = i->inports(); // p4.0.21
- unsigned long ao = i->outports();
- unsigned long ci = i->controlInPorts();
- unsigned long co = i->controlOutPorts();
-
- bool addFlag = false;
-
- if (i->label().toLower().contains(sortValue.toLower()))
- addFlag = true;
- else if (i->name().toLower().contains(sortValue.toLower()))
- addFlag = true;
- if (addFlag) {
+ if (found && addFlag) {
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setText(0, i->lib());
item->setText(1, i->label());
@@ -3415,7 +3459,7 @@ void PluginDialog::fillPlugs(const QString &sortValue)
}
}
}
-
+
//---------------------------------------------------------
// getPlugin
//---------------------------------------------------------
@@ -3423,9 +3467,12 @@ void PluginDialog::fillPlugs(const QString &sortValue)
MusECore::Plugin* PluginDialog::getPlugin(QWidget* parent)
{
PluginDialog* dialog = new PluginDialog(parent);
- if (dialog->exec())
- return dialog->value();
- return 0;
+ MusECore::Plugin* p = 0;
+ int rv = dialog->exec();
+ if(rv)
+ p = dialog->value();
+ delete dialog;
+ return p;
}
// TODO: We need to use .qrc files to use icons in WhatsThis bubbles. See Qt
diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h
index 044fd863..717dc281 100644
--- a/muse2/muse/plugin.h
+++ b/muse2/muse/plugin.h
@@ -60,6 +60,8 @@ class QScrollArea;
class QToolButton;
class QToolButton;
class QTreeWidget;
+class QRect;
+class QByteArray;
namespace MusEGui {
class PluginGui;
@@ -578,25 +580,28 @@ class PluginGui : public QMainWindow {
enum { SEL_SM, SEL_S, SEL_M, SEL_ALL };
class PluginDialog : public QDialog {
+ Q_OBJECT
+
QTreeWidget* pList;
QRadioButton* allPlug;
QRadioButton* onlyM;
QRadioButton* onlyS;
QRadioButton* onlySM;
QPushButton *okB;
-
- Q_OBJECT
+ void saveSettings();
public:
PluginDialog(QWidget* parent=0);
static MusECore::Plugin* getPlugin(QWidget* parent);
MusECore::Plugin* value();
- void accept();
public slots:
+ void accept();
+ void reject();
void fillPlugs(QAbstractButton*);
- void fillPlugs(int i);
- void fillPlugs(const QString& sortValue);
+ //void fillPlugs(int i);
+ //void fillPlugs(const QString& sortValue);
+ void fillPlugs();
private slots:
void enableOkB();
@@ -605,6 +610,10 @@ class PluginDialog : public QDialog {
QComboBox *sortBox;
static int selectedPlugType;
static QStringList sortItems;
+ //static int sortColumn;
+ //static Qt::SortOrder sortOrder;
+ static QRect geometrySave;
+ static QByteArray listSave;
};
}
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index e5353465..bf71f51e 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -40,6 +40,7 @@ QT4_WRAP_CPP (widget_mocs
combobox.h
comment.h
ctrlcombo.h
+ custom_widget_actions.h
dentry.h
didyouknow.h
doublelabel.h
@@ -66,6 +67,7 @@ QT4_WRAP_CPP (widget_mocs
pasteeventsdialog.h
pitchedit.h
pitchlabel.h
+ pixmap_button.h
popupmenu.h
# posedit.h
poslabel.h
@@ -142,6 +144,7 @@ file (GLOB widgets_source_files
combobox.cpp
comment.cpp
ctrlcombo.cpp
+ custom_widget_actions.cpp
dentry.cpp
dimap.cpp
doublelabel.cpp
@@ -170,6 +173,7 @@ file (GLOB widgets_source_files
pasteeventsdialog.cpp
pitchedit.cpp
pitchlabel.cpp
+ pixmap_button.cpp
popupmenu.cpp
# posedit.cpp
poslabel.cpp
diff --git a/muse2/muse/widgets/custom_widget_actions.cpp b/muse2/muse/widgets/custom_widget_actions.cpp
new file mode 100644
index 00000000..952f5083
--- /dev/null
+++ b/muse2/muse/widgets/custom_widget_actions.cpp
@@ -0,0 +1,196 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// custom_widget_actions.cpp
+// (C) Copyright 2011 Tim E. Real (terminator356 on users.sourceforge.net)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//=============================================================================
+
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QSignalMapper>
+#include <QPainter>
+#include <QPaintEvent>
+
+#include "icons.h"
+#include "pixmap_button.h"
+#include "custom_widget_actions.h"
+
+namespace MusEGui {
+
+//---------------------------------------------------------
+// PixmapButtonsHeaderWidgetAction
+//---------------------------------------------------------
+
+PixmapButtonsHeaderWidgetAction::PixmapButtonsHeaderWidgetAction(const QString& text, QPixmap* ref_pixmap, int channels, QWidget* parent)
+ : QWidgetAction(parent)
+{
+ _refPixmap = ref_pixmap;
+ _channels = channels;
+ _text = text;
+ // Just to be safe, set to -1 instead of default 0.
+ setData(-1);
+}
+
+QWidget* PixmapButtonsHeaderWidgetAction::createWidget(QWidget* parent)
+{
+ QWidget* lw = new QWidget(parent);
+ QHBoxLayout* layout = new QHBoxLayout(lw);
+
+ layout->setSpacing(0);
+
+ QLabel* lbl = new QLabel(_text, lw);
+ lbl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+ lbl->setAlignment(Qt::AlignCenter);
+ lbl->setAutoFillBackground(true);
+ //QPalette palette;
+ //palette.setColor(label->backgroundRole(), c);
+ //lbl->setPalette(palette);
+ lbl->setBackgroundRole(QPalette::Dark);
+ layout->addWidget(lbl);
+
+ layout->addSpacing(8);
+ //layout->addStretch();
+
+ QSignalMapper* mapper = new QSignalMapper(this);
+
+ PixmapButton* pb = new PixmapButton(toggle_small_Icon, toggle_small_Icon, 2, lw, QString("T")); // Margin = 2
+ //mapper->setMapping(pb, _channels); // Set to one past end.
+ layout->addWidget(pb);
+ layout->addSpacing(6);
+ //connect(pb, SIGNAL(clicked(bool)), mapper, SLOT(map()));
+
+ for(int i = 0; i < _channels; ++i)
+ {
+ PixmapButton* b = new PixmapButton(_refPixmap, _refPixmap, 2, lw, QString::number(i + 1)); // Margin = 2
+ mapper->setMapping(b, i);
+ connect(b, SIGNAL(pressed()), mapper, SLOT(map()));
+ if((i != 0) && (i % 4 == 0))
+ layout->addSpacing(6);
+ layout->addWidget(b);
+ }
+
+ connect(mapper, SIGNAL(mapped(int)), this, SLOT(chanClickMap(int)));
+
+ return lw;
+}
+
+void PixmapButtonsHeaderWidgetAction::chanClickMap(int /*idx*/)
+{
+ // TODO: Toggle vertical columns... p4.0.42
+
+ trigger();
+}
+
+
+//---------------------------------------------------------
+// PixmapButtonsWidgetAction
+//---------------------------------------------------------
+
+PixmapButtonsWidgetAction::PixmapButtonsWidgetAction(const QString& text, QPixmap* on_pixmap, QPixmap* off_pixmap, int channels, int initial, QWidget* parent)
+ : QWidgetAction(parent)
+ {
+ _onPixmap = on_pixmap;
+ _offPixmap = off_pixmap;
+ _channels = channels;
+ _current = initial;
+ _text = text;
+ // Just to be safe, set to -1 instead of default 0.
+ setData(-1);
+ }
+
+QWidget* PixmapButtonsWidgetAction::createWidget(QWidget *parent)
+{
+ QWidget* lw = new QWidget(parent);
+ QHBoxLayout* layout = new QHBoxLayout(lw);
+
+ layout->setSpacing(0);
+
+ QLabel* lbl = new QLabel(_text, lw);
+ lbl->setAlignment(Qt::AlignCenter);
+ //lbl->setAutoFillBackground(true);
+ //QPalette palette;
+ //palette.setColor(label->backgroundRole(), c);
+ //lbl->setPalette(palette);
+ //lbl->setBackgroundRole(QPalette::Dark);
+ layout->addWidget(lbl);
+
+ layout->addSpacing(8);
+ layout->addStretch();
+
+ QSignalMapper* mapper = new QSignalMapper(this);
+
+ PixmapButton* pb = new PixmapButton(toggle_small_Icon, toggle_small_Icon, 2, lw); // Margin = 2
+ mapper->setMapping(pb, _channels); // Set to one past end.
+ layout->addWidget(pb);
+ layout->addSpacing(6);
+ connect(pb, SIGNAL(pressed()), mapper, SLOT(map()));
+
+ for(int i = 0; i < _channels; ++i)
+ {
+ bool set = _current & (1 << i);
+ PixmapButton* b = new PixmapButton(_onPixmap, _offPixmap, 2, lw); // Margin = 2
+ _chan_buttons.append(b);
+ b->setCheckable(true);
+ b->setDown(set);
+ mapper->setMapping(b, i);
+ connect(b, SIGNAL(toggled(bool)), mapper, SLOT(map()));
+ if((i != 0) && (i % 4 == 0))
+ layout->addSpacing(6);
+ layout->addWidget(b);
+ }
+
+ connect(mapper, SIGNAL(mapped(int)), this, SLOT(chanClickMap(int)));
+
+ return lw;
+}
+
+void PixmapButtonsWidgetAction::chanClickMap(int idx)
+{
+ if(idx == _channels) // One past end = Toggle all button.
+ {
+ int allch = (1 << _channels) - 1;
+ if((_current & allch) == allch)
+ _current = 0;
+ else
+ _current = allch;
+ // Set and redraw the buttons.
+ for(int i = 0; i < _channels; ++i)
+ _chan_buttons.at(i)->setDown(_current != 0);
+ }
+ else
+ {
+ int c = 0;
+ for(int i = 0; i < _channels; ++i)
+ {
+ if(_chan_buttons.at(i)->isChecked())
+ c |= (1 << i);
+ }
+ _current = c;
+ }
+
+ trigger();
+}
+
+void PixmapButtonsWidgetAction::setCurrentState(int state)
+{
+ _current = state;
+ // Set and redraw the buttons.
+ for(int i = 0; i < _channels; ++i)
+ _chan_buttons.at(i)->setDown((_current & (1 << i)) != 0);
+}
+
+} // namespace MusEGui
diff --git a/muse2/muse/widgets/custom_widget_actions.h b/muse2/muse/widgets/custom_widget_actions.h
new file mode 100644
index 00000000..c70da12d
--- /dev/null
+++ b/muse2/muse/widgets/custom_widget_actions.h
@@ -0,0 +1,86 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// custom_widget_actions.h
+// (C) Copyright 2011 Tim E. Real (terminator356 on users.sourceforge.net)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=========================================================
+
+#ifndef __CUSTOM_WIDGET_ACTIONS_H__
+#define __CUSTOM_WIDGET_ACTIONS_H__
+
+#include <QWidgetAction>
+#include <QList>
+
+class QMouseEvent;
+class QPaintEvent;
+class QPixmap;
+
+namespace MusEGui {
+
+class PixmapButton;
+
+//---------------------------------------------------------
+// PixmapButtonsHeaderWidgetAction
+//---------------------------------------------------------
+
+class PixmapButtonsHeaderWidgetAction : public QWidgetAction {
+ Q_OBJECT
+ private:
+
+ QPixmap* _refPixmap;
+ QString _text;
+ int _channels;
+
+ private slots:
+ void chanClickMap(int);
+
+ public:
+ PixmapButtonsHeaderWidgetAction (const QString& text, QPixmap* ref_pixmap, int channels, QWidget* parent = 0);
+ QWidget* createWidget(QWidget* parent);
+ };
+//---------------------------------------------------------
+// PixmapButtonsWidgetAction
+//---------------------------------------------------------
+
+class PixmapButtonsWidgetAction : public QWidgetAction {
+ Q_OBJECT
+ private:
+
+ QString _text;
+ int _channels;
+ int _current;
+ QPixmap* _onPixmap;
+ QPixmap* _offPixmap;
+ QList<PixmapButton*> _chan_buttons;
+
+ private slots:
+ void chanClickMap(int);
+
+ public:
+ PixmapButtonsWidgetAction(const QString& text,
+ QPixmap* on_pixmap, QPixmap* off_pixmap,
+ int channels, int initial,
+ QWidget* parent = 0);
+
+ QWidget* createWidget(QWidget* parent);
+ int currentState() const { return _current; }
+ void setCurrentState(int state);
+ };
+
+} // namespace MusEGui
+#endif // __CUSTOM_WIDGET_ACTIONS_H__
diff --git a/muse2/muse/widgets/doublelabel.cpp b/muse2/muse/widgets/doublelabel.cpp
index dbf7e035..a4b4c9c7 100644
--- a/muse2/muse/widgets/doublelabel.cpp
+++ b/muse2/muse/widgets/doublelabel.cpp
@@ -180,7 +180,7 @@ void DoubleLabel::setPrecision(int v)
QSize DoubleLabel::sizeHint() const
{
QFontMetrics fm = fontMetrics();
- int h = fm.height() + 4;
+ int h = fm.height() + 5;
int n = _precision;
++n; // For some reason I have to add one digit. Shouldn't have to.
diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp
index 19e9729a..a01fbd5f 100644
--- a/muse2/muse/widgets/mtrackinfo.cpp
+++ b/muse2/muse/widgets/mtrackinfo.cpp
@@ -99,13 +99,23 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid
pan = -65;
volume = -1;
- setFont(MusEGlobal::config.fonts[2]);
+ setFont(MusEGlobal::config.fonts[1]);
//iChanDetectLabel->setPixmap(*darkgreendotIcon);
iChanDetectLabel->setPixmap(*darkRedLedIcon);
recEchoButton->setIcon((selected && ((MusECore::MidiTrack*)selected)->recEcho()) ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon));
recEchoButton->setIconSize(midiThruOnIcon->size());
+ //recEchoButton->setOffPixmap(midiThruOffIcon);
+ //recEchoButton->setOnPixmap(midiThruOnIcon);
+
+ iRButton->setIcon(QIcon(*routesMidiInIcon));
+ iRButton->setIconSize(routesMidiInIcon->size());
+ //iRButton->setOffPixmap(routesMidiInIcon);
+
+ oRButton->setIcon(QIcon(*routesMidiOutIcon));
+ oRButton->setIconSize(routesMidiOutIcon->size());
+ //oRButton->setOffPixmap(routesMidiOutIcon);
// MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here.
trackNameLabel->setAlignment(Qt::AlignCenter);
@@ -159,7 +169,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid
connect(iPatch, SIGNAL(released()), SLOT(instrPopup()));
- ///pop = new QMenu(iPatch);
+ //pop = new QMenu(iPatch);
//pop->setCheckable(false); // not needed in Qt4
// Removed by Tim. p3.3.9
@@ -528,7 +538,7 @@ void MidiTrackInfo::configChanged()
// canvas->setBg(QPixmap(MusEGlobal::config.canvasBgPixmap));
//}
- setFont(MusEGlobal::config.fonts[2]);
+ setFont(MusEGlobal::config.fonts[1]);
//updateTrackInfo(type);
}
@@ -666,9 +676,11 @@ void MidiTrackInfo::inRoutesPressed()
if(!selected->isMidiTrack())
return;
- RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- iRButton->setDown(false);
+ //RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), selected, false);
+ delete pup;
+ iRButton->setDown(false);
}
//---------------------------------------------------------
@@ -682,9 +694,11 @@ void MidiTrackInfo::outRoutesPressed()
if(!selected->isMidiTrack())
return;
- RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
- oRButton->setDown(false);
+ //RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();
+ RoutePopupMenu* pup = new RoutePopupMenu();
pup->exec(QCursor::pos(), selected, true);
+ delete pup;
+ oRButton->setDown(false);
}
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui
index 4a4b9c37..0bf58d76 100644
--- a/muse2/muse/widgets/mtrackinfobase.ui
+++ b/muse2/muse/widgets/mtrackinfobase.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>98</width>
- <height>447</height>
+ <width>93</width>
+ <height>417</height>
</rect>
</property>
<property name="sizePolicy">
@@ -59,7 +59,7 @@
<property name="spacing">
<number>0</number>
</property>
- <item row="0" column="0" colspan="3">
+ <item row="0" column="0" colspan="2">
<widget class="QLabel" name="trackNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
@@ -72,7 +72,7 @@
</property>
</widget>
</item>
- <item row="1" column="0" colspan="3">
+ <item row="1" column="0" colspan="2">
<widget class="QComboBox" name="iOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
@@ -110,7 +110,7 @@
</property>
</widget>
</item>
- <item row="2" column="2">
+ <item row="2" column="1">
<widget class="QLabel" name="TextLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -140,7 +140,7 @@
<item>
<widget class="QToolButton" name="iRButton">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -149,33 +149,16 @@
<string>input routing</string>
</property>
<property name="text">
- <string>iR</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="oRButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>output routing</string>
+ <string/>
</property>
- <property name="text">
- <string>oR</string>
+ <property name="iconSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="3" column="2">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
<item>
<widget class="QLabel" name="iChanDetectLabel">
<property name="sizePolicy">
@@ -192,6 +175,9 @@
program change, and pitchbend (but not sysex or realtime) events
on the selected channels, on the selected midi ports.</string>
</property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
<property name="text">
<string>W</string>
</property>
@@ -202,7 +188,7 @@
<bool>false</bool>
</property>
<property name="margin">
- <number>2</number>
+ <number>1</number>
</property>
<property name="indent">
<number>-1</number>
@@ -212,7 +198,7 @@
<item>
<widget class="QToolButton" name="recEchoButton">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -223,12 +209,31 @@
<property name="whatsThis">
<string>Pass input events through ('thru') to output.</string>
</property>
+ <property name="text">
+ <string/>
+ </property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
+ <widget class="QToolButton" name="oRButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>output routing</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="echoSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -271,7 +276,7 @@
</property>
</widget>
</item>
- <item row="4" column="2">
+ <item row="4" column="1" rowspan="2">
<widget class="QLabel" name="TextLabel9">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -290,7 +295,7 @@
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="5" column="0" rowspan="2">
<widget class="MusEGui::SpinBox" name="iVerz">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -312,7 +317,7 @@
</property>
</widget>
</item>
- <item row="5" column="2">
+ <item row="6" column="1">
<widget class="QLabel" name="TextLabel10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -331,7 +336,7 @@
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="7" column="0">
<widget class="MusEGui::SpinBox" name="iLen">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -356,7 +361,7 @@
</property>
</widget>
</item>
- <item row="6" column="2">
+ <item row="7" column="1">
<widget class="QLabel" name="TextLabel11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -375,7 +380,7 @@
</property>
</widget>
</item>
- <item row="7" column="0">
+ <item row="8" column="0">
<widget class="MusEGui::SpinBox" name="iAnschl">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -403,7 +408,7 @@
</property>
</widget>
</item>
- <item row="7" column="2">
+ <item row="8" column="1">
<widget class="QLabel" name="TextLabel12">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -422,7 +427,7 @@
</property>
</widget>
</item>
- <item row="8" column="0">
+ <item row="9" column="0">
<widget class="MusEGui::SpinBox" name="iKompr">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -450,7 +455,7 @@
</property>
</widget>
</item>
- <item row="8" column="2">
+ <item row="9" column="1">
<widget class="QLabel" name="TextLabel13">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -469,7 +474,7 @@
</property>
</widget>
</item>
- <item row="9" column="0" colspan="3">
+ <item row="10" column="0" colspan="2">
<widget class="QLabel" name="TextLabel1_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
@@ -500,7 +505,7 @@
</property>
</widget>
</item>
- <item row="10" column="0" colspan="3">
+ <item row="11" column="0" colspan="2">
<widget class="QPushButton" name="iPatch">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
@@ -516,7 +521,7 @@
</property>
</widget>
</item>
- <item row="11" column="0">
+ <item row="12" column="0">
<widget class="QLabel" name="textLabel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -535,7 +540,7 @@
</property>
</widget>
</item>
- <item row="11" column="1" colspan="2">
+ <item row="12" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
@@ -574,7 +579,7 @@
</item>
</layout>
</item>
- <item row="12" column="0">
+ <item row="13" column="0">
<widget class="MusEGui::SpinBox" name="iHBank">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -602,7 +607,7 @@
</property>
</widget>
</item>
- <item row="12" column="1" colspan="2">
+ <item row="13" column="1">
<widget class="QLabel" name="TextLabel4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -627,7 +632,7 @@
</property>
</widget>
</item>
- <item row="13" column="0">
+ <item row="14" column="0">
<widget class="MusEGui::SpinBox" name="iLBank">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -655,7 +660,7 @@
</property>
</widget>
</item>
- <item row="13" column="1" colspan="2">
+ <item row="14" column="1">
<widget class="QLabel" name="TextLabel5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -680,7 +685,7 @@
</property>
</widget>
</item>
- <item row="14" column="0">
+ <item row="15" column="0">
<widget class="MusEGui::SpinBox" name="iProgram">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -708,7 +713,7 @@
</property>
</widget>
</item>
- <item row="14" column="1" colspan="2">
+ <item row="15" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
@@ -747,7 +752,7 @@
</item>
</layout>
</item>
- <item row="15" column="0">
+ <item row="16" column="0">
<widget class="MusEGui::SpinBox" name="iLautst">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -775,7 +780,7 @@
</property>
</widget>
</item>
- <item row="15" column="1" colspan="2">
+ <item row="16" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>0</number>
@@ -814,7 +819,7 @@
</item>
</layout>
</item>
- <item row="16" column="0">
+ <item row="17" column="0">
<widget class="MusEGui::SpinBox" name="iPan">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -845,7 +850,7 @@
</property>
</widget>
</item>
- <item row="16" column="1" colspan="2">
+ <item row="17" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>0</number>
@@ -884,7 +889,7 @@
</item>
</layout>
</item>
- <item row="17" column="2">
+ <item row="18" column="0">
<spacer name="spacer5">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp
index 6211574d..3131adcc 100644
--- a/muse2/muse/widgets/mtscale.cpp
+++ b/muse2/muse/widgets/mtscale.cpp
@@ -235,7 +235,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
int y = 12;
p.setPen(Qt::black);
- p.setFont(MusEGlobal::config.fonts[4]);
+ p.setFont(MusEGlobal::config.fonts[5]);
p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
QRect tr(r);
tr.setHeight(12);
@@ -425,7 +425,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
else {
num = beat + 1;
y1 = y + 7;
- p.setFont(MusEGlobal::config.fonts[1]);
+ p.setFont(MusEGlobal::config.fonts[4]);
r.setY(y+3);
}
s.setNum(num);
diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp
index c54ef1ad..5cf070f6 100644
--- a/muse2/muse/widgets/mtscale_flo.cpp
+++ b/muse2/muse/widgets/mtscale_flo.cpp
@@ -194,7 +194,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r)
int y = 12;
p.setPen(Qt::black);
- p.setFont(MusEGlobal::config.fonts[4]);
+ p.setFont(MusEGlobal::config.fonts[5]);
p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
QRect tr(r);
tr.setHeight(12);
@@ -319,7 +319,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r)
else {
num = beat + 1;
y1 = y + 7;
- p.setFont(MusEGlobal::config.fonts[1]);
+ p.setFont(MusEGlobal::config.fonts[4]);
r.setY(y+3);
}
s.setNum(num);
diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp
index f707fb7c..8fc29d45 100644
--- a/muse2/muse/widgets/musewidgetsplug.cpp
+++ b/muse2/muse/widgets/musewidgetsplug.cpp
@@ -117,11 +117,11 @@ MusEGlobal::GlobalConfigValues config = {
QColor(200, 200, 200), // waveEditBackgroundColor;
{
QFont(QString("arial"), 10, QFont::Normal),
- QFont(QString("arial"), 8, QFont::Normal),
+ QFont(QString("arial"), 7, QFont::Normal), // Mixer strips and midi track info panel
QFont(QString("arial"), 10, QFont::Normal),
QFont(QString("arial"), 10, QFont::Bold),
- QFont(QString("arial"), 8, QFont::Bold), // timescale numbers
- QFont(QString("Lucidatypewriter"), 14, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Normal), // Small numbers: Timescale and markers, part name overlay
+ QFont(QString("arial"), 8, QFont::Bold), // Small bold numbers such as marker text
QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone,
// at the price of only few more pixels than Normal mode.
},
@@ -172,8 +172,6 @@ MusEGlobal::GlobalConfigValues config = {
QRect(0, 0, 400, 300), // GeometryMain;
QRect(0, 0, 200, 100), // GeometryTransport;
QRect(0, 0, 600, 200), // GeometryBigTime;
- QRect(0, 0, 400, 300), // GeometryPianoroll;
- QRect(0, 0, 400, 300), // GeometryDrumedit;
//QRect(0, 0, 300, 500), // GeometryMixer; // Obsolete
{
QString("Mixer A"),
@@ -191,14 +189,15 @@ MusEGlobal::GlobalConfigValues config = {
false, // BigTimeVisible;
false, // mixer1Visible;
false, // mixer2Visible;
-
false, // markerVisible; // This line was missing 2007-01-08 (willyfoobar)
+ true, // arrangerVisible;
true, // showSplashScreen
1, // canvasShowPartType 1 - names, 2 events
5, // canvasShowPartEvent
false, // canvasShowGrid;
QString(""), // canvasBgPixmap;
- QString(""), // styleSheetFile
+ QStringList(), // canvasCustomBgList
+ QString(""), // default styleSheetFile - For built-in set to ":/style.qss"
QString(""), // style
QString(""), // externalWavEditor //this line was missing 2007-01-08 (willyfoobar)
false, // useOldStyleStopShortCut
@@ -215,7 +214,10 @@ MusEGlobal::GlobalConfigValues config = {
64, // minControlProcessPeriod
false, // popupsDefaultStayOpen
false, // leftMouseButtonCanDecrease
- false // rangeMarkerWithoutMMBCheckBox
+ false, // rangeMarkerWithoutMMBCheckBox
+ true, // addHiddenTracks
+ true // unhideTracks
+
};
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/pixmap_button.cpp b/muse2/muse/widgets/pixmap_button.cpp
new file mode 100644
index 00000000..6b706474
--- /dev/null
+++ b/muse2/muse/widgets/pixmap_button.cpp
@@ -0,0 +1,174 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// pixmap_button.cpp
+// (C) Copyright 2011 Tim E. Real (terminator356 on users.sourceforge.net)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//=============================================================================
+
+#include <QString>
+#include <QWidget>
+#include <QSize>
+#include <QFont>
+#include <QPainter>
+#include <QPixmap>
+#include <QPaintEvent>
+#include <QMouseEvent>
+
+#include "pixmap_button.h"
+
+namespace MusEGui {
+
+PixmapButton::PixmapButton(QWidget* parent)
+ : QWidget(parent)
+{
+ _onPixmap = 0;
+ _offPixmap = 0;
+ _margin = 0;
+ _checked = false;
+ _checkable = false;
+
+ QFont fnt = font();
+ fnt.setPointSize(8);
+ setFont(fnt);
+}
+
+PixmapButton::PixmapButton(QPixmap* on_pixmap, QPixmap* off_pixmap, int margin, QWidget* parent, const QString& text)
+ : QWidget(parent)
+{
+ _text = text;
+ _onPixmap = on_pixmap;
+ _offPixmap = off_pixmap;
+ _margin = margin;
+ _checked = false;
+ _checkable = false;
+ if(_offPixmap)
+ setMinimumSize(_offPixmap->size().width() + 2*_margin, _offPixmap->size().height() + 2*_margin);
+ else
+ setMinimumSize(10 + 2*_margin, 10 + 2*_margin);
+ //font().s
+
+ QFont fnt = font();
+ fnt.setPointSize(8);
+ setFont(fnt);
+}
+
+QSize PixmapButton::minimumSizeHint () const
+{
+ return QSize(10, 10);
+}
+
+void PixmapButton::setMargin(int v)
+{
+ _margin = v;
+ if(_offPixmap)
+ setMinimumSize(_offPixmap->size().width() + 2*_margin, _offPixmap->size().height() + 2*_margin);
+ update();
+}
+
+void PixmapButton::setOffPixmap(QPixmap* pm)
+{
+ _offPixmap = pm;
+ if(_offPixmap)
+ setMinimumSize(_offPixmap->size().width() + 2*_margin, _offPixmap->size().height() + 2*_margin);
+ else
+ setMinimumSize(10 + 2*_margin, 10 + 2*_margin);
+ update();
+}
+
+void PixmapButton::setOnPixmap(QPixmap* pm)
+{
+ _onPixmap = pm;
+ update();
+}
+
+void PixmapButton::setCheckable(bool v)
+{
+ _checkable = v;
+ if(!_checkable)
+ _checked = false;
+ update();
+}
+
+void PixmapButton::setChecked(bool v)
+{
+ if(!_checkable)
+ return;
+ if(_checked == v)
+ return;
+ _checked = v;
+ update();
+ emit toggled(_checked);
+}
+
+void PixmapButton::setDown(bool v)
+{
+ if(!_checkable)
+ return;
+ if(_checked == v)
+ return;
+ _checked = v;
+ update();
+}
+
+void PixmapButton::paintEvent(QPaintEvent* e)
+{
+ QWidget::paintEvent(e);
+ QPainter p(this);
+ int w2 = width() / 2;
+ int h2 = height() / 2;
+ int mw = _offPixmap->size().width();
+ int mh = _offPixmap->size().height();
+ int mw2 = mw / 2;
+ int mh2 = mh / 2;
+ if(!_text.isEmpty())
+ //p.drawText(w2 - mw2, h2 - mh2, mw, mh, *pm);
+ p.drawText(_margin, height() - _margin, _text);
+ else
+ {
+ QPixmap* pm = _checked ? _onPixmap : _offPixmap;
+ if(pm)
+ p.drawPixmap(w2 - mw2, h2 - mh2, mw, mh, *pm);
+ }
+}
+
+void PixmapButton::mousePressEvent(QMouseEvent* e)
+{
+ //if(e->button() != Qt::LeftButton)
+ // return;
+ if(_checkable)
+ _checked = !_checked;
+ update();
+
+ emit pressed();
+ if(_checkable)
+ emit toggled(_checked);
+
+ //e->setAccepted(true); // This makes menu not close when mouse is released. May be desireable with many small buttons...
+ QWidget::mousePressEvent(e);
+}
+
+void PixmapButton::mouseReleaseEvent(QMouseEvent* e)
+{
+ //if(e->button() != Qt::LeftButton)
+ // return;
+ emit clicked(_checked);
+
+ //e->setAccepted(true); // This makes menu not close when mouse is released. May be desireable with many small buttons...
+ QWidget::mouseReleaseEvent(e);
+}
+
+} // MusEGui \ No newline at end of file
diff --git a/muse2/muse/widgets/pixmap_button.h b/muse2/muse/widgets/pixmap_button.h
new file mode 100644
index 00000000..448b17cb
--- /dev/null
+++ b/muse2/muse/widgets/pixmap_button.h
@@ -0,0 +1,87 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// pixmap_button.h
+// (C) Copyright 2011 Tim E. Real (terminator356 on users.sourceforge.net)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=========================================================
+
+#ifndef __PIXMAP_BUTTON_H__
+#define __PIXMAP_BUTTON_H__
+
+#include <QWidget>
+
+class QMouseEvent;
+class QPaintEvent;
+class QPixmap;
+class QString;
+
+namespace MusEGui {
+
+//---------------------------------------------------------
+// PixmapButton
+//---------------------------------------------------------
+
+class PixmapButton : public QWidget
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked)
+ //Q_PROPERTY(QPixmap* offPixmap READ offPixmap WRITE setOffPixmap)
+ //Q_PROPERTY(QPixmap* onPixmap READ onPixmap WRITE setOnPixmap)
+ Q_PROPERTY(int margin READ margin WRITE setMargin)
+
+ private:
+ QString _text;
+ bool _checkable;
+ bool _checked;
+ int _margin;
+ QPixmap* _onPixmap;
+ QPixmap* _offPixmap;
+
+ protected:
+ virtual void paintEvent(QPaintEvent* );
+ virtual void mousePressEvent(QMouseEvent* );
+ virtual void mouseReleaseEvent(QMouseEvent* );
+
+ signals:
+ void clicked(bool checked = false);
+ void toggled(bool checked = false);
+ void pressed();
+
+ public:
+ PixmapButton(QWidget* parent = 0);
+ PixmapButton(QPixmap* on_pixmap, QPixmap* off_pixmap, int margin, QWidget* parent = 0, const QString& text = QString());
+ virtual QSize minimumSizeHint () const;
+ virtual bool margin() const { return _margin; }
+ virtual void setMargin(int v);
+ virtual bool isChecked() const { return _checked; }
+ virtual void setChecked(bool);
+ virtual bool isDown() const { return _checked; }
+ virtual void setDown(bool);
+ virtual bool isCheckable() const { return _checkable; }
+ virtual void setCheckable(bool);
+ virtual QPixmap* offPixmap() const { return _offPixmap; }
+ virtual void setOffPixmap(QPixmap*);
+ virtual QPixmap* onPixmap() const { return _onPixmap; }
+ virtual void setOnPixmap(QPixmap*);
+};
+
+
+} // MusEGui
+#endif // __PIXMAP_BUTTON_H__ \ No newline at end of file
diff --git a/muse2/muse/widgets/popupmenu.cpp b/muse2/muse/widgets/popupmenu.cpp
index af870975..a34418a4 100644
--- a/muse2/muse/widgets/popupmenu.cpp
+++ b/muse2/muse/widgets/popupmenu.cpp
@@ -33,7 +33,7 @@
#include <QApplication>
//#include <QTimer>
-#include <stdio.h>
+//#include <stdio.h>
//#include <QStandardItemModel>
#include "popupmenu.h"
@@ -70,13 +70,10 @@ PopupMenu::PopupMenu(const QString& title, QWidget* parent, bool stayOpen)
init();
}
-PopupMenu::~PopupMenu()
-{
- //printf("PopupMenu::~PopupMenu\n");
-}
-
void PopupMenu::init()
{
+ //printf("PopupMenu::init this:%p\n", this);
+
// Menus will trigger! Set to make sure our trigger handlers ignore menus.
menuAction()->setData(-1);
@@ -92,8 +89,14 @@ void PopupMenu::init()
#endif // POPUP_MENU_DISABLE_AUTO_SCROLL
}
+// NOTE: Tested all RoutePopupMenu and PopupMenu dtors and a couple of action dtors from our
+// PixmapButtonsHeaderWidgetAction and PixmapButtonsWidgetAction:
+// This does not appear to be required any more. All submenus and actions are being deleted now. p4.0.43
+/*
void PopupMenu::clear()
{
+ //printf("PopupMenu::clear this:%p\n", this);
+
QList<QAction*> list = actions();
for(int i = 0; i < list.size(); ++i)
{
@@ -103,6 +106,7 @@ void PopupMenu::clear()
{
menu->clear(); // Recursive.
act->setMenu(0); // CHECK: Is this OK?
+ //printf(" deleting menu:%p\n", menu);
delete menu;
}
}
@@ -115,6 +119,7 @@ void PopupMenu::clear()
connect(timer, SIGNAL(timeout()), SLOT(timerHandler()));
#endif // POPUP_MENU_DISABLE_AUTO_SCROLL
}
+*/
void PopupMenu::clearAllChecks() const
{
diff --git a/muse2/muse/widgets/popupmenu.h b/muse2/muse/widgets/popupmenu.h
index 7fc07698..1848d3af 100644
--- a/muse2/muse/widgets/popupmenu.h
+++ b/muse2/muse/widgets/popupmenu.h
@@ -75,8 +75,7 @@ class PopupMenu : public QMenu
PopupMenu(bool stayOpen);
PopupMenu(QWidget* parent=0, bool stayOpen = false);
PopupMenu(const QString& title, QWidget* parent = 0, bool stayOpen = false);
- ~PopupMenu();
- void clear();
+ ///void clear();
QAction* findActionFromData(const QVariant&) const;
bool stayOpen() const { return _stayOpen; }
void clearAllChecks() const;
diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp
index 0f1f8264..3e2ad008 100644
--- a/muse2/muse/widgets/routepopup.cpp
+++ b/muse2/muse/widgets/routepopup.cpp
@@ -34,6 +34,10 @@
#include "menutitleitem.h"
#include "popupmenu.h"
+#include "custom_widget_actions.h"
+#include "globaldefs.h"
+#define _USE_CUSTOM_WIDGET_ACTIONS_
+
namespace MusEGui {
//---------------------------------------------------------
@@ -617,7 +621,22 @@ int RoutePopupMenu::nonSyntiTrackAddSyntis(MusECore::AudioTrack* t, PopupMenu* l
int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id, bool isOutput)
{
+
+#ifndef _USE_CUSTOM_WIDGET_ACTIONS_
+
QAction* act;
+
+#endif
+
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ PixmapButtonsHeaderWidgetAction* wa_hdr = new PixmapButtonsHeaderWidgetAction("Output port/device", darkRedLedIcon, MIDI_CHANNELS, pup);
+ pup->addAction(wa_hdr);
+ ++id;
+#else
+ pup->addAction(new MenuTitleItem("Output port/device", pup));
+#endif
+
for(int i = 0; i < MIDI_PORTS; ++i)
{
MusECore::MidiPort* mp = &MusEGlobal::midiPorts[i];
@@ -626,19 +645,16 @@ int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id
// This is desirable, but could lead to 'hidden' routes unless we add more support
// such as removing the existing routes when user changes flags.
// So for now, just list all valid ports whether read or write.
- if(!md)
- continue;
- //if(!(md->rwFlags() & (isOutput ? 1 : 2)))
+ //if(!md)
// continue;
+ if(!md || !(md->rwFlags() & (isOutput ? 2 : 1))) // If this is an input click we are looking for midi outputs here.
+ continue;
// Do not list synth devices!
if(md->isSynti())
continue;
- MusECore::RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
-
- PopupMenu* subp = new PopupMenu(pup, true);
- subp->setTitle(md->name());
+ MusECore::RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
int chanmask = 0;
// To reduce number of routes required, from one per channel to just one containing a channel mask.
@@ -653,6 +669,21 @@ int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id
}
}
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + md->name(),
+ redLedIcon, darkRedLedIcon,MIDI_CHANNELS, chanmask, pup);
+ MusECore::Route srcRoute(i, 0); // Ignore the routing channels - our action holds the channels.
+ //wa->setData(id++);
+ wa->setData(qVariantFromValue(srcRoute));
+ pup->addAction(wa);
+ ++id;
+
+#else
+
+ PopupMenu* subp = new PopupMenu(pup, true);
+ subp->setTitle(md->name());
+
for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
{
act = subp->addAction(QString("Channel %1").arg(ch+1));
@@ -677,6 +708,9 @@ int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id
++id;
pup->addMenu(subp);
+
+#endif // _USE_CUSTOM_WIDGET_ACTIONS_
+
}
return id;
}
@@ -687,29 +721,22 @@ int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id
//======================
RoutePopupMenu::RoutePopupMenu(QWidget* parent, MusECore::Track* track, bool isOutput)
- : _track(track), _isOutMenu(isOutput)
+ //: _track(track), _isOutMenu(isOutput)
+ : PopupMenu(parent, true), _track(track), _isOutMenu(isOutput)
{
- _pup = new PopupMenu(parent, true);
init();
}
RoutePopupMenu::RoutePopupMenu(const QString& title, QWidget* parent, MusECore::Track* track, bool isOutput)
- : _track(track), _isOutMenu(isOutput)
+ //: _track(track), _isOutMenu(isOutput)
+ : PopupMenu(title, parent, true), _track(track), _isOutMenu(isOutput)
{
- _pup = new PopupMenu(title, parent, true);
init();
}
-RoutePopupMenu::~RoutePopupMenu()
-{
- //printf("RoutePopupMenu::~RoutePopupMenu\n");
- // Make sure to clear which clears and deletes any sub popups.
- _pup->clear();
- delete _pup;
-}
-
void RoutePopupMenu::init()
{
+ //printf("RoutePopupMenu::init this:%p\n", this);
connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
}
@@ -726,15 +753,19 @@ void RoutePopupMenu::updateRouteMenus()
// In case for some reason a route could not be added (or removed).
// Then the item will be properly un-checked (or checked) here.
+ // TODO Fix this up a bit. It doesn't quite respond to complete removal, and other situations are a bit odd.
+ // Best to ignore it for now since it only half-works. p4.0.42
+
+/*
//printf("RoutePopupMenu::updateRouteMenus\n");
- if(!_track || !_pup || _pup->actions().isEmpty() || !_pup->isVisible())
+ if(!_track || actions().isEmpty() || !isVisible())
return;
MusECore::RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes();
// Clear all the action check marks.
- _pup->clearAllChecks();
+ clearAllChecks();
// Take care of Midi Port to Audio Input routes first...
if(_isOutMenu && _track->isMidiTrack())
@@ -754,10 +785,13 @@ void RoutePopupMenu::updateRouteMenus()
if(ir->channel & chbits)
{
MusECore::Route r(ir->track, chbits);
- //printf("RoutePopupMenu::updateRouteMenus MusECore::MidiPort to AudioInput chbits:%d\n", chbits);
- QAction* act = _pup->findActionFromData(qVariantFromValue(r));
+ //printf("RoutePopupMenu::updateRouteMenus MusECore::MidiPort to AudioInput chbits:%d\n", chbits); //
+ QAction* act = findActionFromData(qVariantFromValue(r));
if(act)
+ {
+ //printf(" ... Found\n"); //
act->setChecked(true);
+ }
}
}
}
@@ -771,6 +805,25 @@ void RoutePopupMenu::updateRouteMenus()
// Do MidiTrack to MidiPort routes...
if(irl->type == MusECore::Route::MIDI_PORT_ROUTE)
{
+
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ // Widget action handles channels. Look for route with channels ignored and set to zero.
+ MusECore::Route r(irl->midiPort, 0);
+ QAction* act = findActionFromData(qVariantFromValue(r));
+ if(act)
+ {
+ //printf("RoutePopupMenu::updateRouteMenus found MidiTrack to MidiPort irl type:%d\n", irl->type); //
+ // Check for custom widget actions first.
+ PixmapButtonsWidgetAction* mc_wa = dynamic_cast<PixmapButtonsWidgetAction*>(act);
+ if(mc_wa)
+ {
+ //printf(" ... Found custom, setting current state\n"); //
+ mc_wa->setCurrentState(irl->channel); // Set all channels at once.
+ }
+ }
+
+#else
//printf("RoutePopupMenu::updateRouteMenus MIDI_PORT_ROUTE\n");
for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
{
@@ -778,33 +831,67 @@ void RoutePopupMenu::updateRouteMenus()
if(irl->channel & chbits)
{
MusECore::Route r(irl->midiPort, chbits);
- QAction* act = _pup->findActionFromData(qVariantFromValue(r));
+ //printf("RoutePopupMenu::updateRouteMenus MidiTrack to MidiPort irl type:%d\n", irl->type); //
+ // If act is a PixmapButtonsWidgetAction, route channel is ignored and is zero.
+ QAction* act = findActionFromData(qVariantFromValue(r));
if(act)
+ {
+ //printf(" ... Found\n"); //
act->setChecked(true);
+ }
}
}
+#endif // _USE_CUSTOM_WIDGET_ACTIONS_
+
}
else
// Do all other routes...
{
- //printf("RoutePopupMenu::updateRouteMenus other irl type:%d\n", irl->type);
- QAction* act = _pup->findActionFromData(qVariantFromValue(*irl));
+
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ // Do MidiPort to MidiTrack routes...
+ if(irl->type == MusECore::Route::TRACK_ROUTE && irl->track && irl->track->type() == MusECore::Track::AUDIO_INPUT)
+ {
+ // Widget action handles channels. Look for route with channels ignored and set to zero.
+ MusECore::Route r(irl->track, 0);
+ QAction* act = findActionFromData(qVariantFromValue(r));
+ if(act)
+ {
+ // Check for custom widget actions first.
+ PixmapButtonsWidgetAction* mc_wa = dynamic_cast<PixmapButtonsWidgetAction*>(act);
+ if(mc_wa)
+ {
+ //printf("RoutePopupMenu::updateRouteMenus found custom irl type:%d\n", irl->type); //
+ mc_wa->setCurrentState(irl->channel); // Set all channels at once.
+ continue;
+ }
+ }
+ }
+
+#endif // _USE_CUSTOM_WIDGET_ACTIONS_
+
+ printf("RoutePopupMenu::updateRouteMenus other irl type:%d\n", irl->type); // REMOVE TIm.
if(act)
+ {
+ //printf("RoutePopupMenu::updateRouteMenus found other irl type:%d\n", irl->type); //
act->setChecked(true);
+ }
}
}
+*/
}
void RoutePopupMenu::popupActivated(QAction* action)
{
- if(!action || !_track || !_pup || _pup->actions().isEmpty())
+ if(!action || !_track || actions().isEmpty())
return;
if(_track->isMidiTrack())
{
MusECore::RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes();
- // Take care of Route data items first...
+ // Take care of Route data items first...
if(qVariantCanConvert<MusECore::Route>(action->data()))
{
MusECore::Route aRoute = action->data().value<MusECore::Route>();
@@ -836,13 +923,10 @@ void RoutePopupMenu::popupActivated(QAction* action)
MusECore::RouteList* mprl = _isOutMenu ? mp->outRoutes() : mp->inRoutes();
MusECore::ciRoute ir = mprl->begin();
for (; ir != mprl->end(); ++ir)
- {
- if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == aRoute.track) // Is there already a route to this port?
- {
- chmask = ir->channel; // Grab the channel mask.
- break;
+ if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == aRoute.track) { // Is there already a route to this port?
+ chmask = ir->channel; // Grab the channel mask.
+ break;
}
- }
if ((chmask & chbit) == chbit) // Is the channel's bit(s) set?
{
// disconnect
@@ -866,56 +950,113 @@ void RoutePopupMenu::popupActivated(QAction* action)
}
return;
}
+ // Support Audio Input track to Midi Port routes.
else if(aRoute.type == MusECore::Route::MIDI_PORT_ROUTE)
{
- int chbit = aRoute.channel;
- MusECore::Route bRoute(_track, chbit);
- int mdidx = aRoute.midiPort;
-
- MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mdidx];
- MusECore::MidiDevice* md = mp->device();
- //if(!md) // Rem. Allow connections to ports with no device.
- // return;
-
- //if(!(md->rwFlags() & 2))
- //if(!(md->rwFlags() & (gIsOutRoutingPopupMenu ? 1 : 2)))
- if(md && !(md->rwFlags() & (_isOutMenu ? 1 : 2)))
- return;
-
- int chmask = 0;
- MusECore::ciRoute iir = rl->begin();
- for (; iir != rl->end(); ++iir)
+ // Check for custom midi channel select action.
+ PixmapButtonsWidgetAction* cs_wa = dynamic_cast<PixmapButtonsWidgetAction*>(action);
+ if(cs_wa)
{
- if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port?
+ MusECore::Route aRoute = action->data().value<MusECore::Route>();
+ int chbits = cs_wa->currentState();
+ aRoute.channel = chbits; // Restore the desired route channels from the custom widget action state.
+
+ int mdidx = aRoute.midiPort;
+ MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mdidx];
+
+ MusECore::MidiDevice* md = mp->device();
+ //if(!md) // Rem. Allow connections to ports with no device.
+ // return;
+
+ //if(!(md->rwFlags() & 2))
+ //if(!(md->rwFlags() & (gIsOutRoutingPopupMenu ? 1 : 2)))
+ if(md && !(md->rwFlags() & (_isOutMenu ? 1 : 2)))
+ return;
+
+ int chmask = 0;
+ MusECore::ciRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) { // Is there already a route to this port?
+ chmask = iir->channel; // Grab the channel mask.
+ break;
+ }
+
+ // Only if something changed...
+ if(chmask != chbits)
{
- chmask = iir->channel; // Grab the channel mask.
- break;
- }
- }
- if ((chmask & chbit) == chbit) // Is the channel's bit(s) set?
- {
- // disconnect
- if(_isOutMenu)
- MusEGlobal::audio->msgRemoveRoute(bRoute, aRoute);
- else
- MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute);
+ if(chmask != 0)
+ {
+ MusECore::Route bRoute(_track, chmask);
+ // Disconnect all existing channels.
+ if(_isOutMenu)
+ MusEGlobal::audio->msgRemoveRoute(bRoute, *iir);
+ else
+ MusEGlobal::audio->msgRemoveRoute(*iir, bRoute);
+ }
+ if(chbits != 0)
+ {
+ // Connect desired channels.
+ MusECore::Route bRoute(_track, chbits);
+ if(_isOutMenu)
+ MusEGlobal::audio->msgAddRoute(bRoute, aRoute);
+ else
+ MusEGlobal::audio->msgAddRoute(aRoute, bRoute);
+ }
+ MusEGlobal::audio->msgUpdateSoloStates();
+ MusEGlobal::song->update(SC_ROUTE);
+ }
+ //return;
}
- else
+ else
{
- // connect
- if(_isOutMenu)
- MusEGlobal::audio->msgAddRoute(bRoute, aRoute);
- else
- MusEGlobal::audio->msgAddRoute(aRoute, bRoute);
+ int chbit = aRoute.channel;
+ MusECore::Route bRoute(_track, chbit);
+ int mdidx = aRoute.midiPort;
+
+ MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mdidx];
+ MusECore::MidiDevice* md = mp->device();
+ //if(!md) // Rem. Allow connections to ports with no device.
+ // return;
+
+ //if(!(md->rwFlags() & 2))
+ //if(!(md->rwFlags() & (gIsOutRoutingPopupMenu ? 1 : 2)))
+ if(md && !(md->rwFlags() & (_isOutMenu ? 1 : 2)))
+ return;
+
+ int chmask = 0;
+ MusECore::ciRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ {
+ if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port?
+ {
+ chmask = iir->channel; // Grab the channel mask.
+ break;
+ }
+ }
+ if ((chmask & chbit) == chbit) // Is the channel's bit(s) set?
+ {
+ // disconnect
+ if(_isOutMenu)
+ MusEGlobal::audio->msgRemoveRoute(bRoute, aRoute);
+ else
+ MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute);
+ }
+ else
+ {
+ // connect
+ if(_isOutMenu)
+ MusEGlobal::audio->msgAddRoute(bRoute, aRoute);
+ else
+ MusEGlobal::audio->msgAddRoute(aRoute, bRoute);
+ }
+
+ MusEGlobal::audio->msgUpdateSoloStates();
+ MusEGlobal::song->update(SC_ROUTE);
}
-
- MusEGlobal::audio->msgUpdateSoloStates();
- MusEGlobal::song->update(SC_ROUTE);
}
}
- else
// ... now take care of integer data items.
- if(qVariantCanConvert<int>(action->data()))
+ else if(qVariantCanConvert<int>(action->data()))
{
int n = action->data().value<int>();
if(!_isOutMenu && n == 0)
@@ -961,34 +1102,73 @@ void RoutePopupMenu::popupActivated(QAction* action)
// Support Midi Port to Audio Input routes.
if(_track->type() == MusECore::Track::AUDIO_INPUT && srcRoute.type == MusECore::Route::MIDI_PORT_ROUTE)
{
- int chbit = srcRoute.channel;
- MusECore::Route dstRoute(t, chbit);
- int mdidx = srcRoute.midiPort;
- int chmask = 0;
- MusECore::ciRoute iir = rl->begin();
- for (; iir != rl->end(); ++iir)
+ // Check for custom midi channel select action.
+ PixmapButtonsWidgetAction* cs_wa = dynamic_cast<PixmapButtonsWidgetAction*>(action);
+ if(cs_wa)
{
- if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port?
+ int chbits = cs_wa->currentState();
+ srcRoute.channel = chbits; // Restore the desired route channels from the custom widget action state.
+ int mdidx = srcRoute.midiPort;
+
+ int chmask = 0;
+ MusECore::ciRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) { // Is there already a route to this port?
+ chmask = iir->channel; // Grab the channel mask.
+ break;
+ }
+
+ // Only if something changed...
+ if(chmask != chbits)
{
- chmask = iir->channel; // Grab the channel mask.
- break;
- }
- }
-
- if ((chmask & chbit) == chbit) // Is the channel's bit(s) set?
- {
- //printf("routingPopupMenuActivated: removing src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel);
- MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute);
+ if(chmask != 0)
+ {
+ // Disconnect all existing channels.
+ MusECore::Route dstRoute(t, chmask);
+ MusEGlobal::audio->msgRemoveRoute(*iir, dstRoute);
+ }
+ if(chbits != 0)
+ {
+ // Connect desired channels.
+ MusECore::Route dstRoute(t, chbits);
+ MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ MusEGlobal::audio->msgUpdateSoloStates();
+ MusEGlobal::song->update(SC_ROUTE);
+ }
+ return;
}
- else
+ else
{
- //printf("routingPopupMenuActivated: adding src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel);
- MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute);
- }
-
- MusEGlobal::audio->msgUpdateSoloStates();
- MusEGlobal::song->update(SC_ROUTE);
- return;
+ int chbit = srcRoute.channel;
+ MusECore::Route dstRoute(t, chbit);
+ int mdidx = srcRoute.midiPort;
+ int chmask = 0;
+ MusECore::ciRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ {
+ if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port?
+ {
+ chmask = iir->channel; // Grab the channel mask.
+ break;
+ }
+ }
+
+ if ((chmask & chbit) == chbit) // Is the channel's bit(s) set?
+ {
+ //printf("routingPopupMenuActivated: removing src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel);
+ MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else
+ {
+ //printf("routingPopupMenuActivated: adding src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel);
+ MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute);
+ }
+
+ MusEGlobal::audio->msgUpdateSoloStates();
+ MusEGlobal::song->update(SC_ROUTE);
+ return;
+ }
}
MusECore::Route dstRoute(t, srcRoute.channel, srcRoute.channels);
@@ -1020,13 +1200,13 @@ void RoutePopupMenu::popupActivated(QAction* action)
void RoutePopupMenu::prepare()
{
- _pup->disconnect();
- _pup->clear();
+ ///disconnect();
+ ///clear();
if(!_track)
return;
- connect(_pup, SIGNAL(triggered(QAction*)), SLOT(popupActivated(QAction*)));
+ connect(this, SIGNAL(triggered(QAction*)), SLOT(popupActivated(QAction*)));
if(_track->isMidiTrack())
{
@@ -1055,11 +1235,11 @@ void RoutePopupMenu::prepare()
//if(!md)
// continue;
- _pup->addSeparator();
- _pup->addAction(new MenuTitleItem(tr("Soloing chain"), _pup));
- PopupMenu* subp = new PopupMenu(_pup, true);
+ addSeparator();
+ addAction(new MenuTitleItem(tr("Soloing chain"), this));
+ PopupMenu* subp = new PopupMenu(this, true);
subp->setTitle(tr("Audio returns"));
- _pup->addMenu(subp);
+ addMenu(subp);
MusECore::InputList* al = MusEGlobal::song->inputs();
for (MusECore::ciAudioInput i = al->begin(); i != al->end(); ++i)
@@ -1096,19 +1276,26 @@ void RoutePopupMenu::prepare()
}
if(pi == MIDI_PORTS)
{
- act = _pup->addAction(tr("Warning: No input devices!"));
+ act = addAction(tr("Warning: No input devices!"));
act->setCheckable(false);
act->setData(-1);
- _pup->addSeparator();
+ addSeparator();
}
- act = _pup->addAction(QIcon(*settings_midiport_softsynthsIcon), tr("Open midi config..."));
+ act = addAction(QIcon(*settings_midiport_softsynthsIcon), tr("Open midi config..."));
act->setCheckable(false);
act->setData(gid);
- _pup->addSeparator();
+ addSeparator();
++gid;
- _pup->addAction(new MenuTitleItem("Input port/device", _pup));
-
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ PixmapButtonsHeaderWidgetAction* wa_hdr = new PixmapButtonsHeaderWidgetAction("Input port/device", darkRedLedIcon, MIDI_CHANNELS, this);
+ addAction(wa_hdr);
+ ++gid;
+#else
+ addAction(new MenuTitleItem("Input port/device", this));
+#endif
+
for(int i = 0; i < MIDI_PORTS; ++i)
{
// NOTE: Could possibly list all devices, bypassing ports, but no, let's stick with ports.
@@ -1142,7 +1329,19 @@ void RoutePopupMenu::prepare()
if(!md && ir == rl->end())
continue;
- PopupMenu* subp = new PopupMenu(_pup, true);
+#ifdef _USE_CUSTOM_WIDGET_ACTIONS_
+
+ PixmapButtonsWidgetAction* wa = new PixmapButtonsWidgetAction(QString::number(i + 1) + ":" + md->name(),
+ redLedIcon, darkRedLedIcon, MIDI_CHANNELS, chanmask, this);
+ MusECore::Route srcRoute(i, 0); // Ignore the routing channels - our action holds the channels.
+ //wa->setData(id++);
+ wa->setData(qVariantFromValue(srcRoute));
+ addAction(wa);
+ ++gid;
+
+#else
+
+ PopupMenu* subp = new PopupMenu(this, true);
subp->setTitle(QString("%1:").arg(i+1) + (md ? md->name() : tr("<none>")));
for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
@@ -1162,7 +1361,10 @@ void RoutePopupMenu::prepare()
MusECore::Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits.
act->setData(qVariantFromValue(togRoute));
++gid;
- _pup->addMenu(subp);
+ addMenu(subp);
+
+#endif // _USE_CUSTOM_WIDGET_ACTIONS_
+
}
#if 0
@@ -1242,18 +1444,18 @@ void RoutePopupMenu::prepare()
{
char buffer[128];
snprintf(buffer, 128, "%s %d", tr("Channel").toLatin1().constData(), i+1);
- MenuTitleItem* titel = new MenuTitleItem(QString(buffer), _pup);
- _pup->addAction(titel);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer), this);
+ addAction(titel);
if(!MusEGlobal::checkAudioDevice())
{
- _pup->clear();
+ clear();
return;
}
std::list<QString> ol = MusEGlobal::audioDevice->inputPorts();
for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
{
- act = _pup->addAction(*ip);
+ act = addAction(*ip);
act->setCheckable(true);
MusECore::Route dst(*ip, true, i, MusECore::Route::JACK_ROUTE);
@@ -1269,42 +1471,42 @@ void RoutePopupMenu::prepare()
}
}
if(i+1 != channel)
- _pup->addSeparator();
+ addSeparator();
}
//
// Display using separate menu for audio inputs:
//
- _pup->addSeparator();
- _pup->addAction(new MenuTitleItem(tr("Soloing chain"), _pup));
- PopupMenu* subp = new PopupMenu(_pup, true);
+ addSeparator();
+ addAction(new MenuTitleItem(tr("Soloing chain"), this));
+ PopupMenu* subp = new PopupMenu(this, true);
subp->setTitle(tr("Audio returns"));
- _pup->addMenu(subp);
+ addMenu(subp);
gid = addInPorts(t, subp, gid, -1, -1, true);
//
// Display all in the same menu:
//
- //_pup->addSeparator();
- //MenuTitleItem* title = new MenuTitleItem(tr("Audio returns"), _pup);
- //_pup->addAction(title);
- //gid = addInPorts(t, _pup, gid, -1, -1, true);
+ //addSeparator();
+ //MenuTitleItem* title = new MenuTitleItem(tr("Audio returns"), this);
+ //addAction(title);
+ //gid = addInPorts(t, this, gid, -1, -1, true);
}
break;
case MusECore::Track::AUDIO_SOFTSYNTH:
- gid = addMultiChannelPorts(t, _pup, gid, true);
+ gid = addMultiChannelPorts(t, this, gid, true);
break;
case MusECore::Track::AUDIO_INPUT:
case MusECore::Track::WAVE:
case MusECore::Track::AUDIO_GROUP:
case MusECore::Track::AUDIO_AUX:
- gid = addWavePorts( t, _pup, gid, -1, -1, true);
- gid = addOutPorts( t, _pup, gid, -1, -1, true);
- gid = addGroupPorts( t, _pup, gid, -1, -1, true);
- gid = nonSyntiTrackAddSyntis(t, _pup, gid, true);
+ gid = addWavePorts( t, this, gid, -1, -1, true);
+ gid = addOutPorts( t, this, gid, -1, -1, true);
+ gid = addGroupPorts( t, this, gid, -1, -1, true);
+ gid = nonSyntiTrackAddSyntis(t, this, gid, true);
break;
default:
- _pup->clear();
+ clear();
return;
}
}
@@ -1327,18 +1529,18 @@ void RoutePopupMenu::prepare()
{
char buffer[128];
snprintf(buffer, 128, "%s %d", tr("Channel").toLatin1().constData(), i+1);
- MenuTitleItem* titel = new MenuTitleItem(QString(buffer), _pup);
- _pup->addAction(titel);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer), this);
+ addAction(titel);
if(!MusEGlobal::checkAudioDevice())
{
- _pup->clear();
+ clear();
return;
}
std::list<QString> ol = MusEGlobal::audioDevice->outputPorts();
for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
{
- act = _pup->addAction(*ip);
+ act = addAction(*ip);
act->setCheckable(true);
MusECore::Route dst(*ip, true, i, MusECore::Route::JACK_ROUTE);
@@ -1354,59 +1556,59 @@ void RoutePopupMenu::prepare()
}
}
if(i+1 != channel)
- _pup->addSeparator();
+ addSeparator();
}
//
// Display using separate menus for midi ports and audio outputs:
//
- _pup->addSeparator();
- _pup->addAction(new MenuTitleItem(tr("Soloing chain"), _pup));
- PopupMenu* subp = new PopupMenu(_pup, true);
+ addSeparator();
+ addAction(new MenuTitleItem(tr("Soloing chain"), this));
+ PopupMenu* subp = new PopupMenu(this, true);
subp->setTitle(tr("Audio sends"));
- _pup->addMenu(subp);
+ addMenu(subp);
gid = addOutPorts(t, subp, gid, -1, -1, false);
- subp = new PopupMenu(_pup, true);
+ subp = new PopupMenu(this, true);
subp->setTitle(tr("Midi port sends"));
- _pup->addMenu(subp);
+ addMenu(subp);
addMidiPorts(t, subp, gid, false);
//
// Display all in the same menu:
//
- //_pup->addAction(new MenuTitleItem(tr("Audio sends"), _pup));
- //gid = addOutPorts(t, _pup, gid, -1, -1, false);
- //_pup->addSeparator();
- //_pup->addAction(new MenuTitleItem(tr("Midi sends"), _pup));
- //addMidiPorts(t, _pup, gid, false);
+ //addAction(new MenuTitleItem(tr("Audio sends"), this));
+ //gid = addOutPorts(t, this, gid, -1, -1, false);
+ //addSeparator();
+ //addAction(new MenuTitleItem(tr("Midi sends"), this));
+ //addMidiPorts(t, this, gid, false);
}
break;
case MusECore::Track::AUDIO_OUTPUT:
- gid = addWavePorts( t, _pup, gid, -1, -1, false);
- gid = addInPorts( t, _pup, gid, -1, -1, false);
- gid = addGroupPorts(t, _pup, gid, -1, -1, false);
- gid = addAuxPorts( t, _pup, gid, -1, -1, false);
- gid = nonSyntiTrackAddSyntis(t, _pup, gid, false);
+ gid = addWavePorts( t, this, gid, -1, -1, false);
+ gid = addInPorts( t, this, gid, -1, -1, false);
+ gid = addGroupPorts(t, this, gid, -1, -1, false);
+ gid = addAuxPorts( t, this, gid, -1, -1, false);
+ gid = nonSyntiTrackAddSyntis(t, this, gid, false);
break;
case MusECore::Track::WAVE:
- gid = addWavePorts( t, _pup, gid, -1, -1, false);
- gid = addInPorts( t, _pup, gid, -1, -1, false);
- gid = addGroupPorts(t, _pup, gid, -1, -1, false);
- gid = addAuxPorts( t, _pup, gid, -1, -1, false);
- gid = nonSyntiTrackAddSyntis(t, _pup, gid, false);
+ gid = addWavePorts( t, this, gid, -1, -1, false);
+ gid = addInPorts( t, this, gid, -1, -1, false);
+ gid = addGroupPorts(t, this, gid, -1, -1, false);
+ gid = addAuxPorts( t, this, gid, -1, -1, false);
+ gid = nonSyntiTrackAddSyntis(t, this, gid, false);
break;
case MusECore::Track::AUDIO_GROUP:
- gid = addWavePorts( t, _pup, gid, -1, -1, false);
- gid = addInPorts( t, _pup, gid, -1, -1, false);
- gid = addGroupPorts(t, _pup, gid, -1, -1, false);
- gid = addAuxPorts( t, _pup, gid, -1, -1, false);
- gid = nonSyntiTrackAddSyntis(t, _pup, gid, false);
+ gid = addWavePorts( t, this, gid, -1, -1, false);
+ gid = addInPorts( t, this, gid, -1, -1, false);
+ gid = addGroupPorts(t, this, gid, -1, -1, false);
+ gid = addAuxPorts( t, this, gid, -1, -1, false);
+ gid = nonSyntiTrackAddSyntis(t, this, gid, false);
break;
case MusECore::Track::AUDIO_SOFTSYNTH:
- gid = addMultiChannelPorts(t, _pup, gid, false);
+ gid = addMultiChannelPorts(t, this, gid, false);
break;
default:
- _pup->clear();
+ clear();
return;
}
}
@@ -1421,7 +1623,7 @@ void RoutePopupMenu::exec(MusECore::Track* track, bool isOutput)
_isOutMenu = isOutput;
}
prepare();
- _pup->exec();
+ PopupMenu::exec();
}
void RoutePopupMenu::exec(const QPoint& p, MusECore::Track* track, bool isOutput)
@@ -1432,7 +1634,7 @@ void RoutePopupMenu::exec(const QPoint& p, MusECore::Track* track, bool isOutput
_isOutMenu = isOutput;
}
prepare();
- _pup->exec(p);
+ PopupMenu::exec(p);
}
void RoutePopupMenu::popup(const QPoint& p, MusECore::Track* track, bool isOutput)
@@ -1443,7 +1645,7 @@ void RoutePopupMenu::popup(const QPoint& p, MusECore::Track* track, bool isOutpu
_isOutMenu = isOutput;
}
prepare();
- _pup->popup(p);
+ PopupMenu::popup(p);
}
} // namespace MusEGui
diff --git a/muse2/muse/widgets/routepopup.h b/muse2/muse/widgets/routepopup.h
index 842ba130..e4ecde4c 100644
--- a/muse2/muse/widgets/routepopup.h
+++ b/muse2/muse/widgets/routepopup.h
@@ -23,7 +23,8 @@
#ifndef __ROUTEPOPUPMENU_H__
#define __ROUTEPOPUPMENU_H__
-#include <QObject>
+//#include <QObject>
+#include "popupmenu.h"
namespace MusECore {
class AudioTrack;
@@ -37,13 +38,14 @@ class QPoint;
namespace MusEGui {
-class PopupMenu;
+//class PopupMenu;
-class RoutePopupMenu : public QObject
+//class RoutePopupMenu : public QObject
+class RoutePopupMenu : public PopupMenu
{
Q_OBJECT
- PopupMenu* _pup;
+ //PopupMenu* _pup;
MusECore::Track* _track;
// Whether the route popup was shown by clicking the output routes button, or input routes button.
bool _isOutMenu;
@@ -70,7 +72,6 @@ class RoutePopupMenu : public QObject
public:
RoutePopupMenu(QWidget* parent = 0, MusECore::Track* track = 0, bool isOutput = false);
RoutePopupMenu(const QString& title, QWidget* parent = 0, MusECore::Track* track = 0, bool isOutput = false);
- ~RoutePopupMenu();
void updateRouteMenus();
void exec(MusECore::Track* track = 0, bool isOutput = false);