summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets
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/widgets
parentc36a5508aa42e596b005425208054af9a60734b4 (diff)
merged again
Diffstat (limited to 'muse2/muse/widgets')
-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
15 files changed, 1031 insertions, 256 deletions
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);