diff options
author | Florian Jung <flo@windfisch.org> | 2011-09-10 17:06:00 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-09-10 17:06:00 +0000 |
commit | 24f84a489364741eb3fc126a3f83d91a86b65e27 (patch) | |
tree | 63a4e20aaf4a2ebd2462c91b574eddceeac31170 /muse2/muse/mixer | |
parent | 38c5cccc7273247353264bb7dc97f42296d8e259 (diff) | |
parent | 2120ea4f083228dde0d7307203391a4ec8f57e2d (diff) |
merged the first bunch of orcans changes
STILL WAIT WITH COMMITTING NEW STUFF! i have to merge the rest as well!
this is a bit buggy (connect errors, not tested much), but doesn't
segfault immediately
Diffstat (limited to 'muse2/muse/mixer')
-rw-r--r-- | muse2/muse/mixer/CMakeLists.txt | 13 | ||||
-rw-r--r-- | muse2/muse/mixer/amixer.cpp | 22 | ||||
-rw-r--r-- | muse2/muse/mixer/amixer.h | 21 | ||||
-rw-r--r-- | muse2/muse/mixer/astrip.cpp | 166 | ||||
-rw-r--r-- | muse2/muse/mixer/astrip.h | 38 | ||||
-rw-r--r-- | muse2/muse/mixer/auxknob.cpp | 24 | ||||
-rw-r--r-- | muse2/muse/mixer/auxknob.h | 19 | ||||
-rw-r--r-- | muse2/muse/mixer/mstrip.cpp | 73 | ||||
-rw-r--r-- | muse2/muse/mixer/mstrip.h | 42 | ||||
-rw-r--r-- | muse2/muse/mixer/panknob.cpp | 31 | ||||
-rw-r--r-- | muse2/muse/mixer/panknob.h | 15 | ||||
-rw-r--r-- | muse2/muse/mixer/rack.cpp | 143 | ||||
-rw-r--r-- | muse2/muse/mixer/rack.h | 17 | ||||
-rw-r--r-- | muse2/muse/mixer/routedialog.cpp | 17 | ||||
-rw-r--r-- | muse2/muse/mixer/routedialog.h | 15 | ||||
-rw-r--r-- | muse2/muse/mixer/strip.cpp | 39 | ||||
-rw-r--r-- | muse2/muse/mixer/strip.h | 24 |
17 files changed, 548 insertions, 171 deletions
diff --git a/muse2/muse/mixer/CMakeLists.txt b/muse2/muse/mixer/CMakeLists.txt index 3d76ebd6..f8365038 100644 --- a/muse2/muse/mixer/CMakeLists.txt +++ b/muse2/muse/mixer/CMakeLists.txt @@ -3,10 +3,12 @@ # Linux Music Editor # $Id:$ # -# Copyright (C) 2002-2006 by Werner Schweer and others +# Copyright (C) 1999-2011 by Werner Schweer and others # # This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2. +# it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either 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 @@ -14,8 +16,9 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #============================================================================= ## @@ -26,7 +29,6 @@ QT4_WRAP_CPP ( mixer_mocs astrip.h auxknob.h mstrip.h - panknob.h rack.h routedialog.h strip.h @@ -48,7 +50,6 @@ file (GLOB mixer_source_files astrip.cpp auxknob.cpp mstrip.cpp - panknob.cpp rack.cpp routedialog.cpp strip.cpp diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index f59a2187..08e1aad4 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -4,6 +4,21 @@ // $Id: amixer.cpp,v 1.49.2.5 2009/11/16 01:55:55 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 <list> @@ -30,7 +45,10 @@ #include "gconfig.h" #include "xml.h" +//namespace MusEApp { FINDMICHJETZT dirty, dirty. this is implemented in arrangerview.cpp, +// currently in global namespace. where to put it? in an own code file? helper.cpp? extern QActionGroup* populateAddTrack(QMenu* addTrack); +//} #define __WIDTH_COMPENSATION 4 @@ -143,7 +161,7 @@ bool ScrollArea::viewportEvent(QEvent* event) // inputs | synthis | tracks | groups | master //--------------------------------------------------------- -AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) +AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) : QMainWindow(parent) { cfg = c; @@ -219,7 +237,7 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) ///connect(this, SIGNAL(layoutRequest()), SLOT(setSizing())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); song->update(); // calls update mixer } diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h index ca8a3f4c..1726ba7b 100644 --- a/muse2/muse/mixer/amixer.h +++ b/muse2/muse/mixer/amixer.h @@ -4,6 +4,21 @@ // $Id: amixer.h,v 1.27.2.2 2009/10/18 06:13:00 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 __AMIXER_H__ @@ -33,7 +48,9 @@ class ComboBox; class RouteDialog; class Strip; +namespace MusEConfig { struct MixerConfig; +} #define EFX_HEIGHT 16 @@ -65,7 +82,7 @@ class AudioMixerApp : public QMainWindow { Q_OBJECT //QString name; - MixerConfig* cfg; + MusEConfig::MixerConfig* cfg; StripList stripList; QScrollArea* view; QWidget* central; @@ -123,7 +140,7 @@ class AudioMixerApp : public QMainWindow { public: //AudioMixerApp(QWidget* parent); - AudioMixerApp(QWidget* parent, MixerConfig* c); + AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c); //void write(Xml&, const char* name); //void write(int level, Xml& xml, const char* name); void write(int level, Xml& xml); diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index 97ddc98c..4084a7d4 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -4,6 +4,21 @@ // $Id: astrip.cpp,v 1.23.2.17 2009/11/16 01:55:55 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 <fastlog.h> @@ -26,11 +41,12 @@ #include <QVariant> #include <QAction> #include <QGridLayout> +//#include <QLinearGradient> #include "app.h" #include "globals.h" #include "audio.h" -#include "driver/audiodev.h" +//#include "driver/audiodev.h" #include "song.h" #include "slider.h" #include "knob.h" @@ -116,7 +132,7 @@ void AudioStrip::songChanged(int val) AudioTrack* src = (AudioTrack*)track; - // Do channels before config... + // Do channels before MusEConfig::config... if (val & SC_CHANNELS) updateChannels(); @@ -126,12 +142,12 @@ void AudioStrip::songChanged(int val) // Added by Tim. p3.3.9 // Set the strip label's font. - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); setLabelFont(); // Adjust minimum volume slider and label values. - slider->setRange(config.minSlider-0.1, 10.0); - sl->setRange(config.minSlider, 10.0); + slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); + sl->setRange(MusEConfig::config.minSlider, 10.0); // Adjust minimum aux knob and label values. int n = auxKnob.size(); @@ -139,15 +155,15 @@ void AudioStrip::songChanged(int val) { auxKnob[idx]->blockSignals(true); auxLabel[idx]->blockSignals(true); - auxKnob[idx]->setRange(config.minSlider-0.1, 10.0); - auxLabel[idx]->setRange(config.minSlider, 10.1); + auxKnob[idx]->setRange(MusEConfig::config.minSlider-0.1, 10.0); + auxLabel[idx]->setRange(MusEConfig::config.minSlider, 10.1); auxKnob[idx]->blockSignals(false); auxLabel[idx]->blockSignals(false); } // Adjust minimum meter values. for(int c = 0; c < channel; ++c) - meter[c]->setRange(config.minMeter, 10.0); + meter[c]->setRange(MusEConfig::config.minMeter, 10.0); } if (mute && (val & SC_MUTE)) { // mute && off @@ -210,19 +226,32 @@ void AudioStrip::songChanged(int val) autoType->blockSignals(true); autoType->setCurrentItem(track->automationType()); QPalette palette; + //QLinearGradient gradient(autoType->geometry().topLeft(), autoType->geometry().bottomLeft()); if(track->automationType() == AUTO_TOUCH || track->automationType() == AUTO_WRITE) { palette.setColor(QPalette::Button, QColor(Qt::red)); + //QColor c(Qt::red); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } else if(track->automationType() == AUTO_READ) { palette.setColor(QPalette::Button, QColor(Qt::green)); + //QColor c(Qt::green); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } else { palette.setColor(QPalette::Button, qApp->palette().color(QPalette::Active, QPalette::Background)); + //QColor c(qApp->palette().color(QPalette::Active, QPalette::Background)); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } @@ -359,7 +388,7 @@ void AudioStrip::stereoToggled(bool val) void AudioStrip::auxChanged(double val, int idx) { double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -391,16 +420,17 @@ void AudioStrip::volumeChanged(double val) track->enableVolumeController(false); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } else vol = pow(10.0, val/20.0); volume = vol; - audio->msgSetVolume((AudioTrack*)track, vol); + //audio->msgSetVolume((AudioTrack*)track, vol); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setVolume(vol); + ((AudioTrack*)track)->setVolume(vol); + song->controllerChange(track); ((AudioTrack*)track)->recordAutomation(AC_VOLUME, vol); @@ -420,16 +450,17 @@ void AudioStrip::volumePressed() double val = slider->value(); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; //val -= 1.0; // display special value "off" } else vol = pow(10.0, val/20.0); volume = vol; - audio->msgSetVolume((AudioTrack*)track, volume); + //audio->msgSetVolume((AudioTrack*)track, volume); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setVolume(volume); + ((AudioTrack*)track)->setVolume(volume); + song->controllerChange(track); ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, volume); } @@ -465,7 +496,7 @@ void AudioStrip::volLabelChanged(double val) track->enableVolumeController(false); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -473,9 +504,10 @@ void AudioStrip::volLabelChanged(double val) vol = pow(10.0, val/20.0); volume = vol; slider->setValue(val); - audio->msgSetVolume((AudioTrack*)track, vol); + //audio->msgSetVolume((AudioTrack*)track, vol); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setVolume(vol); + ((AudioTrack*)track)->setVolume(vol); + song->controllerChange(track); ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, vol); } @@ -491,9 +523,10 @@ void AudioStrip::panChanged(double val) track->enablePanController(false); panVal = val; - audio->msgSetPan(((AudioTrack*)track), val); + //audio->msgSetPan(((AudioTrack*)track), val); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setPan(val); + ((AudioTrack*)track)->setPan(val); + song->controllerChange(track); ((AudioTrack*)track)->recordAutomation(AC_PAN, val); } @@ -509,9 +542,11 @@ void AudioStrip::panPressed() track->enablePanController(false); panVal = pan->value(); - audio->msgSetPan(((AudioTrack*)track), panVal); + //audio->msgSetPan(((AudioTrack*)track), panVal); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setPan(panVal); + ((AudioTrack*)track)->setPan(panVal); + song->controllerChange(track); + ((AudioTrack*)track)->startAutoRecord(AC_PAN, panVal); } @@ -546,9 +581,11 @@ void AudioStrip::panLabelChanged(double val) panVal = val; pan->setValue(val); - audio->msgSetPan((AudioTrack*)track, val); + //audio->msgSetPan((AudioTrack*)track, val); // p4.0.21 audio->msgXXX waits. Do we really need to? - //((AudioTrack*)track)->setPan(val); + ((AudioTrack*)track)->setPan(val); + song->controllerChange(track); + ((AudioTrack*)track)->startAutoRecord(AC_PAN, val); } @@ -564,9 +601,9 @@ void AudioStrip::updateChannels() if (c > channel) { for (int cc = channel; cc < c; ++cc) { - meter[cc] = new Meter(this); - //meter[cc]->setRange(config.minSlider, 10.0); - meter[cc]->setRange(config.minMeter, 10.0); + meter[cc] = new MusEWidget::Meter(this); + //meter[cc]->setRange(MusEConfig::config.minSlider, 10.0); + meter[cc]->setRange(MusEConfig::config.minMeter, 10.0); meter[cc]->setFixedWidth(15); connect(meter[cc], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignLeft); @@ -587,19 +624,19 @@ void AudioStrip::updateChannels() } //--------------------------------------------------------- -// addKnob +// addMusEWidget::Knob // type = 0 - panorama // 1 - aux send //--------------------------------------------------------- -Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) +MusEWidget::Knob* AudioStrip::addKnob(int type, int id, MusEWidget::DoubleLabel** dlabel) { - Knob* knob = new Knob(this); + MusEWidget::Knob* knob = new MusEWidget::Knob(this); knob->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); if (type == 0) knob->setRange(-1.0, +1.0); else - knob->setRange(config.minSlider-0.1, 10.0); + knob->setRange(MusEConfig::config.minSlider-0.1, 10.0); knob->setBackgroundRole(QPalette::Mid); if (type == 0) @@ -607,16 +644,16 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) else knob->setToolTip(tr("aux send level")); - DoubleLabel* pl; + MusEWidget::DoubleLabel* pl; if (type == 0) - pl = new DoubleLabel(0, -1.0, +1.0, this); + pl = new MusEWidget::DoubleLabel(0, -1.0, +1.0, this); else - pl = new DoubleLabel(0.0, config.minSlider, 10.1, this); + pl = new MusEWidget::DoubleLabel(0.0, MusEConfig::config.minSlider, 10.1, this); if (dlabel) *dlabel = pl; pl->setSlider(knob); - pl->setFont(config.fonts[1]); + pl->setFont(MusEConfig::config.fonts[1]); pl->setBackgroundRole(QPalette::Mid); pl->setFrame(true); if (type == 0) @@ -633,7 +670,7 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) label.sprintf("Aux%d", id+1); QLabel* plb = new QLabel(label, this); - plb->setFont(config.fonts[1]); + plb->setFont(MusEConfig::config.fonts[1]); plb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); plb->setAlignment(Qt::AlignCenter); @@ -696,7 +733,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) int ch = 0; for (; ch < channel; ++ch) - meter[ch] = new Meter(this); + meter[ch] = new MusEWidget::Meter(this); for (; ch < MAX_CHANNELS; ++ch) meter[ch] = 0; @@ -713,7 +750,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- stereo = new QToolButton(); - stereo->setFont(config.fonts[1]); + stereo->setFont(MusEConfig::config.fonts[1]); QIcon stereoSet; stereoSet.addPixmap(*monoIcon, QIcon::Normal, QIcon::Off); stereoSet.addPixmap(*stereoIcon, QIcon::Normal, QIcon::On); @@ -731,7 +768,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) stereo->setEnabled(false); pre = new QToolButton(); - pre->setFont(config.fonts[1]); + pre->setFont(MusEConfig::config.fonts[1]); pre->setCheckable(true); pre->setText(tr("Pre")); pre->setToolTip(tr("pre fader - post fader")); @@ -749,8 +786,8 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) int auxsSize = song->auxs()->size(); if (t->hasAuxSend()) { for (int idx = 0; idx < auxsSize; ++idx) { - DoubleLabel* al; - Knob* ak = addKnob(1, idx, &al); + MusEWidget::DoubleLabel* al; + MusEWidget::Knob* ak = addKnob(1, idx, &al); auxKnob.push_back(ak); auxLabel.push_back(al); double val = fast_log10(t->auxSend(idx))*20.0; @@ -773,19 +810,19 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) sliderGrid->setContentsMargins(0, 0, 0, 0); sliderGrid->setSpacing(0); - slider = new Slider(this, "vol", Qt::Vertical, Slider::None, - Slider::BgTrough | Slider::BgSlot); + slider = new MusEWidget::Slider(this, "vol", Qt::Vertical, MusEWidget::Slider::None); + slider->setCursorHoming(true); - slider->setRange(config.minSlider-0.1, 10.0); + slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); slider->setFixedWidth(20); - slider->setFont(config.fonts[1]); + slider->setFont(MusEConfig::config.fonts[1]); slider->setValue(fast_log10(t->volume())*20.0); sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); for (int i = 0; i < channel; ++i) { - //meter[i]->setRange(config.minSlider, 10.0); - meter[i]->setRange(config.minMeter, 10.0); + //meter[i]->setRange(MusEConfig::config.minSlider, 10.0); + meter[i]->setRange(MusEConfig::config.minMeter, 10.0); meter[i]->setFixedWidth(15); connect(meter[i], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter); @@ -794,9 +831,9 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) sliderGrid->addItem(new QSpacerItem(2,0),0,3); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); - sl = new DoubleLabel(0.0, config.minSlider, 10.0, this); + sl = new MusEWidget::DoubleLabel(0.0, MusEConfig::config.minSlider, 10.0, this); sl->setSlider(slider); - sl->setFont(config.fonts[1]); + sl->setFont(MusEConfig::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSuffix(tr("dB")); sl->setFrame(true); @@ -825,7 +862,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- if (track->canRecord()) { - record = new TransparentToolButton(this); + record = new MusEWidget::TransparentToolButton(this); record->setCheckable(true); record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); record->setBackgroundRole(QPalette::Mid); @@ -882,7 +919,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) solo->setToolTip(tr("solo mode")); } - off = new TransparentToolButton(this); + off = new MusEWidget::TransparentToolButton(this); QIcon iconSet; iconSet.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On); iconSet.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off); @@ -908,7 +945,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) if (type != Track::AUDIO_AUX) { iR = new QToolButton(); - iR->setFont(config.fonts[1]); + iR->setFont(MusEConfig::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -918,7 +955,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) } oR = new QToolButton(); - oR->setFont(config.fonts[1]); + oR->setFont(MusEConfig::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -930,8 +967,8 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) // automation type //--------------------------------------------------- - autoType = new ComboBox(); - autoType->setFont(config.fonts[1]); + autoType = new MusEWidget::ComboBox(); + autoType->setFont(MusEConfig::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); autoType->addAction(tr("Off"), AUTO_OFF); @@ -941,19 +978,32 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) autoType->setCurrentItem(t->automationType()); QPalette palette; + //QLinearGradient gradient(autoType->geometry().topLeft(), autoType->geometry().bottomLeft()); if(t->automationType() == AUTO_TOUCH || t->automationType() == AUTO_WRITE) { palette.setColor(QPalette::Button, QColor(Qt::red)); + //QColor c(Qt::red); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } else if(t->automationType() == AUTO_READ) { palette.setColor(QPalette::Button, QColor(Qt::green)); + //QColor c(Qt::green); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } else { palette.setColor(QPalette::Button, qApp->palette().color(QPalette::Active, QPalette::Background)); + //QColor c(qApp->palette().color(QPalette::Active, QPalette::Background)); + //gradient.setColorAt(0, c); + //gradient.setColorAt(1, c.darker()); + //palette.setBrush(QPalette::Button, gradient); autoType->setPalette(palette); } @@ -966,7 +1016,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) updateOffState(); // init state off->blockSignals(false); } - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); } //--------------------------------------------------------- @@ -975,7 +1025,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) void AudioStrip::iRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -986,7 +1036,7 @@ void AudioStrip::iRoutePressed() void AudioStrip::oRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h index 92867033..fc25bb9b 100644 --- a/muse2/muse/mixer/astrip.h +++ b/muse2/muse/mixer/astrip.h @@ -4,6 +4,21 @@ // $Id: astrip.h,v 1.8.2.6 2009/11/14 03:37:48 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 __ASTRIP_H__ @@ -14,17 +29,20 @@ #include "strip.h" //#include "route.h" +namespace MusEWidget { +class DoubleLabel; class Slider; class Knob; +class TransparentToolButton; +} + //class QDialog; class QToolButton; //class QAction; //class QPopupMenu; //class PopupMenu; class QButton; -class TransparentToolButton; class AudioTrack; -class DoubleLabel; class EffectRack; //--------------------------------------------------------- @@ -35,19 +53,19 @@ class AudioStrip : public Strip { Q_OBJECT int channel; - Slider* slider; - DoubleLabel* sl; + MusEWidget::Slider* slider; + MusEWidget::DoubleLabel* sl; EffectRack* rack; - Knob* pan; - DoubleLabel* panl; + MusEWidget::Knob* pan; + MusEWidget::DoubleLabel* panl; - std::vector<Knob*> auxKnob; - std::vector<DoubleLabel*> auxLabel; + std::vector<MusEWidget::Knob*> auxKnob; + std::vector<MusEWidget::DoubleLabel*> auxLabel; QToolButton* stereo; QToolButton* pre; - TransparentToolButton* off; + MusEWidget::TransparentToolButton* off; double volume; double panVal; @@ -55,7 +73,7 @@ class AudioStrip : public Strip { //QToolButton* iR; //QToolButton* oR; - Knob* addKnob(int, int, DoubleLabel**); + MusEWidget::Knob* addKnob(int, int, MusEWidget::DoubleLabel**); void updateOffState(); void updateVolume(); diff --git a/muse2/muse/mixer/auxknob.cpp b/muse2/muse/mixer/auxknob.cpp index a64f3929..a9b9c4e2 100644 --- a/muse2/muse/mixer/auxknob.cpp +++ b/muse2/muse/mixer/auxknob.cpp @@ -4,21 +4,38 @@ // $Id: auxknob.cpp,v 1.7 2004/07/11 16:26:46 wschweer Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 <cmath> #include "auxknob.h" #include "gconfig.h" +namespace MusEWidget { + //--------------------------------------------------------- // Aux //--------------------------------------------------------- AuxKnob::AuxKnob(QWidget* parent, int i) - : Knob(parent, "aux") + : MusEWidget::Knob(parent, "aux") { idx = i; - setRange(config.minSlider-0.1, 10.0); + setRange(MusEConfig::config.minSlider-0.1, 10.0); connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double))); } @@ -29,7 +46,7 @@ AuxKnob::AuxKnob(QWidget* parent, int i) void AuxKnob::valueChanged(double val) { double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -38,3 +55,4 @@ void AuxKnob::valueChanged(double val) emit auxChanged(idx, vol); } +} // namespace MusEWidget diff --git a/muse2/muse/mixer/auxknob.h b/muse2/muse/mixer/auxknob.h index c2b8ec7a..c8693698 100644 --- a/muse2/muse/mixer/auxknob.h +++ b/muse2/muse/mixer/auxknob.h @@ -4,6 +4,21 @@ // $Id: auxknob.h,v 1.3 2003/11/08 15:10:18 wschweer Exp $ // // (C) Copyright 2000 Werner Schweer (ws@seh.de) +// +// 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 __AUXKNOB_H__ @@ -11,6 +26,8 @@ #include "knob.h" +namespace MusEWidget { + //--------------------------------------------------------- // AuxKnob //--------------------------------------------------------- @@ -29,5 +46,7 @@ class AuxKnob : public Knob { AuxKnob(QWidget* parent, int idx); }; +} // namespace MusEWidget + #endif diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index ad21916d..d8e09adb 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -4,6 +4,21 @@ // $Id: mstrip.cpp,v 1.9.2.13 2009/11/14 03:37:48 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 <fastlog.h> @@ -77,7 +92,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, mn = mc->minVal(); mx = mc->maxVal(); - Knob* knob = new Knob(this); + MusEWidget::Knob* knob = new MusEWidget::Knob(this); knob->setRange(double(mn), double(mx), 1.0); knob->setId(ctl); @@ -87,12 +102,12 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, knob->setToolTip(tt); knob->setEnabled(enabled); - DoubleLabel* dl = new DoubleLabel(0.0, double(mn), double(mx), this); + MusEWidget::DoubleLabel* dl = new MusEWidget::DoubleLabel(0.0, double(mn), double(mx), this); dl->setId(idx); dl->setSpecialText(tr("off")); dl->setToolTip(tr("double click on/off")); controller[idx].dl = dl; - dl->setFont(config.fonts[1]); + dl->setFont(MusEConfig::config.fonts[1]); dl->setBackgroundRole(QPalette::Mid); dl->setFrame(true); dl->setPrecision(0); @@ -135,7 +150,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, QLabel* lb = new QLabel(label, this); controller[idx].lb = lb; - lb->setFont(config.fonts[1]); + lb->setFont(MusEConfig::config.fonts[1]); lb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); lb->setAlignment(Qt::AlignCenter); lb->setEnabled(enabled); @@ -188,15 +203,15 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) int mn = mc->minVal(); int mx = mc->maxVal(); - slider = new Slider(this, "vol", Qt::Vertical, Slider::None, - Slider::BgTrough | Slider::BgSlot); + slider = new MusEWidget::Slider(this, "vol", Qt::Vertical, MusEWidget::Slider::None, + QColor(100, 255, 100)); slider->setCursorHoming(true); slider->setRange(double(mn), double(mx), 1.0); slider->setFixedWidth(20); - slider->setFont(config.fonts[1]); + slider->setFont(MusEConfig::config.fonts[1]); slider->setId(CTRL_VOLUME); - meter[0] = new Meter(this, Meter::LinMeter); + meter[0] = new MusEWidget::Meter(this, MusEWidget::Meter::LinMeter); meter[0]->setRange(0, 127.0); meter[0]->setFixedWidth(15); connect(meter[0], SIGNAL(mousePress()), this, SLOT(resetPeaks())); @@ -207,8 +222,8 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignLeft); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); - sl = new DoubleLabel(0.0, -98.0, 0.0, this); - sl->setFont(config.fonts[1]); + sl = new MusEWidget::DoubleLabel(0.0, -98.0, 0.0, this); + sl->setFont(MusEConfig::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSpecialText(tr("off")); sl->setSuffix(tr("dB")); @@ -275,7 +290,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // record, mixdownfile //--------------------------------------------------- - record = new TransparentToolButton(this); + record = new MusEWidget::TransparentToolButton(this); record->setBackgroundRole(QPalette::Mid); record->setCheckable(true); record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); @@ -333,7 +348,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // Special here: Must make label same size as the 'exit' button would be IF this were an audio strip... // (The 'exit1' icon is BIGGER than the 'record on' icon.) - TransparentToolButton* off = new TransparentToolButton(this); + MusEWidget::TransparentToolButton* off = new MusEWidget::TransparentToolButton(this); QIcon iconOff; iconOff.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On); iconOff.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off); @@ -352,14 +367,14 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) dcs.sprintf("%d-%d", port + 1, channel + 1); dev_ch_label->setText(dcs); //dev_ch_label->setBackgroundColor(QColor(0, 160, 255)); // Med blue - //dev_ch_label->setFont(config.fonts[6]); - dev_ch_label->setFont(config.fonts[1]); + //dev_ch_label->setFont(MusEConfig::config.fonts[6]); + dev_ch_label->setFont(MusEConfig::config.fonts[1]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, config.fonts[6].pointSize(), 5); + //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); QToolTip::add(dev_ch_label, tr("output port and channel")); */ - off = new TransparentToolButton(this); + off = new MusEWidget::TransparentToolButton(this); QIcon iconOff; iconOff.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On); iconOff.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off); @@ -382,7 +397,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //--------------------------------------------------- iR = new QToolButton(); - iR->setFont(config.fonts[1]); + iR->setFont(MusEConfig::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -390,7 +405,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) grid->addWidget(iR, _curGridRow, 0); connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed())); oR = new QToolButton(); - oR->setFont(config.fonts[1]); + oR->setFont(MusEConfig::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -405,8 +420,8 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // automation mode //--------------------------------------------------- - autoType = new ComboBox(); - autoType->setFont(config.fonts[1]); + autoType = new MusEWidget::ComboBox(); + autoType->setFont(MusEConfig::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); autoType->setEnabled(false); @@ -421,7 +436,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //connect(autoType, SIGNAL(activated(int)), SLOT(setAutomationType(int))); grid->addWidget(autoType, _curGridRow++, 0, 1, 2); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); inHeartBeat = false; } @@ -505,7 +520,7 @@ void MidiStrip::songChanged(int val) if (val & SC_CONFIG) { // Set the strip label's font. - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); setLabelFont(); } } @@ -659,7 +674,7 @@ void MidiStrip::updateControls() { //if(nvolume != volume) //{ - // DoubleLabel ignores the value if already set... + // MusEWidget::DoubleLabel ignores the value if already set... sl->setValue(sl->off() - 1.0); //volume = nvolume; //} @@ -721,7 +736,7 @@ void MidiStrip::updateControls() int npan = mp->hwCtrlState(channel, CTRL_PANPOT); if(npan == CTRL_VAL_UNKNOWN) { - // DoubleLabel ignores the value if already set... + // MusEWidget::DoubleLabel ignores the value if already set... //if(npan != pan) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); @@ -773,7 +788,7 @@ void MidiStrip::updateControls() int nvariSend = icl->second->hwVal(); if(nvariSend == CTRL_VAL_UNKNOWN) { - // DoubleLabel ignores the value if already set... + // MusEWidget::DoubleLabel ignores the value if already set... //if(nvariSend != variSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); @@ -821,7 +836,7 @@ void MidiStrip::updateControls() int nreverbSend = icl->second->hwVal(); if(nreverbSend == CTRL_VAL_UNKNOWN) { - // DoubleLabel ignores the value if already set... + // MusEWidget::DoubleLabel ignores the value if already set... //if(nreverbSend != reverbSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); @@ -869,7 +884,7 @@ void MidiStrip::updateControls() int nchorusSend = icl->second->hwVal(); if(nchorusSend == CTRL_VAL_UNKNOWN) { - // DoubleLabel ignores the value if already set... + // MusEWidget::DoubleLabel ignores the value if already set... //if(nchorusSend != chorusSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); @@ -997,7 +1012,7 @@ void MidiStrip::setReverbSend(double val) void MidiStrip::iRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -1008,7 +1023,7 @@ void MidiStrip::iRoutePressed() void MidiStrip::oRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h index 39b55d21..2f0a133d 100644 --- a/muse2/muse/mixer/mstrip.h +++ b/muse2/muse/mixer/mstrip.h @@ -4,6 +4,21 @@ // $Id: mstrip.h,v 1.4.2.4 2009/10/25 19:26:29 lunar_shuttle Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 __MSTRIP_H__ @@ -12,15 +27,20 @@ #include "strip.h" #include <QLabel> -class Slider; -class DoubleLabel; +class QAction; class QDialog; -class Knob; -class QString; -class MidiTrack; class QLabel; -class QAction; +class QString; + +namespace MusEWidget { +class DoubleLabel; +class Knob; +class Slider; class TransparentToolButton; +} + +class MidiTrack; + //--------------------------------------------------------- // MidiStrip @@ -29,13 +49,13 @@ class TransparentToolButton; class MidiStrip : public Strip { Q_OBJECT - Slider* slider; - DoubleLabel* sl; - TransparentToolButton* off; + MusEWidget::Slider* slider; + MusEWidget::DoubleLabel* sl; + MusEWidget::TransparentToolButton* off; struct KNOB { - Knob* knob; - DoubleLabel* dl; + MusEWidget::Knob* knob; + MusEWidget::DoubleLabel* dl; QLabel* lb; } controller[4]; // pan variation reverb chorus diff --git a/muse2/muse/mixer/panknob.cpp b/muse2/muse/mixer/panknob.cpp index 598bf5bf..077b39e1 100644 --- a/muse2/muse/mixer/panknob.cpp +++ b/muse2/muse/mixer/panknob.cpp @@ -4,18 +4,34 @@ // $Id: panknob.cpp,v 1.5 2004/01/23 08:41:38 wschweer Exp $ // // (C) Copyright 2000 Werner Schweer (ws@seh.de) +// +// 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 "../audio.h" +//#include "../audio.h" +#include "song.h" #include "panknob.h" #include "track.h" //--------------------------------------------------------- -// PanKnob +// PanMusEWidget::Knob //--------------------------------------------------------- -PanKnob::PanKnob(QWidget* parent, AudioTrack* s) - : Knob(parent, "pan") +PanMusEWidget::Knob::PanMusEWidget::Knob(QWidget* parent, AudioTrack* s) + : MusEWidget::Knob(parent, "pan") { src = s; connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double))); @@ -25,11 +41,12 @@ PanKnob::PanKnob(QWidget* parent, AudioTrack* s) // panChanged //--------------------------------------------------------- -void PanKnob::valueChanged(double val) +void PanMusEWidget::Knob::valueChanged(double val) { - audio->msgSetPan(src, val); + //audio->msgSetPan(src, val); // p4.0.21 audio->msgXXX waits. Do we really need to? - //src->setPan(val); + src->setPan(val); + song->controllerChange(src); } diff --git a/muse2/muse/mixer/panknob.h b/muse2/muse/mixer/panknob.h index 92c41b03..5fcb2171 100644 --- a/muse2/muse/mixer/panknob.h +++ b/muse2/muse/mixer/panknob.h @@ -4,6 +4,21 @@ // $Id: panknob.h,v 1.3 2003/11/08 15:10:18 wschweer Exp $ // // (C) Copyright 2000 Werner Schweer (ws@seh.de) +// +// 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 __PANKNOB_H__ diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index c2333e9d..9e7dc754 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -4,6 +4,21 @@ // $Id: rack.cpp,v 1.7.2.7 2007/01/27 14:52:43 spamatica Exp $ // // (C) Copyright 2000-2003 Werner Schweer (ws@seh.de) +// +// 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 <QByteArray> @@ -16,6 +31,7 @@ #include <QMouseEvent> #include <QPainter> #include <QPalette> +#include <QStyledItemDelegate> #include <QUrl> #include <errno.h> @@ -31,6 +47,77 @@ #include "filedialog.h" //--------------------------------------------------------- +// class EffectRackDelegate +//--------------------------------------------------------- + +class EffectRackDelegate : public QStyledItemDelegate { + + EffectRack* er; + AudioTrack* tr; + + public: + void paint ( QPainter * painter, + const QStyleOptionViewItem & option, + const QModelIndex & index ) const; + EffectRackDelegate(QObject * parent, AudioTrack* at ); +}; + +EffectRackDelegate::EffectRackDelegate(QObject * parent, AudioTrack* at ) : QStyledItemDelegate(parent) { + er = (EffectRack*) parent; + tr = at; +} + +void EffectRackDelegate::paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const { + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + + QRect rr = er->visualItemRect(er->item(index.row())); + QRect cr = QRect(rr.x()+1, rr.y()+1, + rr.width()-2, rr.height() -2); + painter->fillRect(rr, option.palette.dark().color().darker(130)); + + QColor mask_edge = QColor(110, 110, 110, 55); + QColor mask_center = QColor(220, 220, 220, 55); + QLinearGradient mask; + mask.setColorAt(0, mask_edge); + mask.setColorAt(0.5, mask_center); + mask.setColorAt(1, mask_edge); + mask.setStart(QPointF(0, cr.y())); + mask.setFinalStop(QPointF(0, cr.y() + cr.height())); + + painter->setBrush(tr->efxPipe()->isOn(index.row()) ? + option.palette.mid() : + option.palette.dark()); + painter->setPen(Qt::NoPen); + painter->drawRoundedRect(cr, 2, 2); + painter->setBrush(mask); + painter->drawRoundedRect(cr, 2, 2); + + QString name = tr->efxPipe()->name(index.row()); + if (name.length() > 11) + name = name.left(9) + "..."; + + if (option.state & QStyle::State_Selected) + { + if (option.state & QStyle::State_MouseOver) + painter->setPen(QPen(QColor(239,239,239))); + else + painter->setPen(QPen(Qt::white)); + } + else if (option.state & QStyle::State_MouseOver) + painter->setPen(QPen(QColor(48,48,48))); + else + painter->setPen(QPen(Qt::black)); + + painter->drawText(cr.x()+2, cr.y()+1, + cr.width()-2, cr.height()-1, + Qt::AlignLeft, name); + + painter->restore(); +} + + +//--------------------------------------------------------- // class RackSlot //--------------------------------------------------------- @@ -39,7 +126,7 @@ class RackSlot : public QListWidgetItem { AudioTrack* node; public: - RackSlot(QListWidget* lb, AudioTrack* t, int i); + RackSlot(QListWidget* lb, AudioTrack* t, int i, int h); ~RackSlot(); void setBackgroundColor(const QBrush& brush) {setBackground(brush);}; }; @@ -53,12 +140,12 @@ RackSlot::~RackSlot() // RackSlot //--------------------------------------------------------- -RackSlot::RackSlot(QListWidget* b, AudioTrack* t, int i) +RackSlot::RackSlot(QListWidget* b, AudioTrack* t, int i, int h) : QListWidgetItem(b) { node = t; idx = i; - setSizeHint(QSize(10,17)); + setSizeHint(QSize(10,h)); } //--------------------------------------------------------- @@ -71,36 +158,37 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t) setObjectName("Rack"); setAttribute(Qt::WA_DeleteOnClose); track = t; - setFont(config.fonts[1]); + itemheight = 19; + setFont(MusEConfig::config.fonts[1]); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSelectionMode(QAbstractItemView::SingleSelection); - setMaximumHeight(19 * PipelineDepth); + for (int i = 0; i < PipelineDepth; ++i) - new RackSlot(this, track, i); + new RackSlot(this, track, i, itemheight); updateContents(); connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(doubleClicked(QListWidgetItem*))); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + EffectRackDelegate* er_delegate = new EffectRackDelegate(this, track); + setItemDelegate(er_delegate); + setSpacing(0); - QPalette qpal; - qpal.setColor(QPalette::Base, QColor(palette().midlight().color())); - setPalette(qpal); setAcceptDrops(true); } void EffectRack::updateContents() { - for (int i = 0; i < PipelineDepth; ++i) { - QString name = track->efxPipe()->name(i); - item(i)->setText(name); - item(i)->setBackground(track->efxPipe()->isOn(i) ? palette().mid() : palette().dark()); - item(i)->setToolTip(name == QString("empty") ? tr("effect rack") : name ); - } + for (int i = 0; i < PipelineDepth; ++i) { + QString name = track->efxPipe()->name(i); + item(i)->setText(name); + item(i)->setBackground(track->efxPipe()->isOn(i) ? palette().mid() : palette().dark()); + item(i)->setToolTip(name == QString("empty") ? tr("effect rack") : name ); + } } //--------------------------------------------------------- @@ -128,7 +216,8 @@ void EffectRack::songChanged(int typ) QSize EffectRack::minimumSizeHint() const { - return QSize(10, 19 * PipelineDepth); + // FIXME(Orcan): Why do we have to manually add 6 pixels? + return QSize(10, itemheight * PipelineDepth + 6); } //--------------------------------------------------------- @@ -171,11 +260,11 @@ void EffectRack::menuRequested(QListWidgetItem* it) RackSlot* curitem = (RackSlot*)it; int idx = row(curitem); QString name; - bool mute; + //bool mute; Pipeline* pipe = track->efxPipe(); if (pipe) { name = pipe->name(idx); - mute = pipe->isOn(idx); + //mute = pipe->isOn(idx); } //enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE }; @@ -325,8 +414,8 @@ void EffectRack::doubleClicked(QListWidgetItem* it) void EffectRack::savePreset(int idx) { - //QString name = getSaveFileName(QString(""), plug_file_pattern, this, - QString name = getSaveFileName(QString(""), preset_file_save_pattern, this, + //QString name = MusEWidget::getSaveFileName(QString(""), plug_file_pattern, this, + QString name = MusEWidget::getSaveFileName(QString(""), MusEGlobal::preset_file_save_pattern, this, tr("MusE: Save Preset")); if(name.isEmpty()) @@ -334,7 +423,7 @@ void EffectRack::savePreset(int idx) //FILE* presetFp = fopen(name.ascii(),"w+"); bool popenFlag; - FILE* presetFp = fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true); + FILE* presetFp = MusEWidget::fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true); if (presetFp == 0) { //fprintf(stderr, "EffectRack::savePreset() fopen failed: %s\n", // strerror(errno)); @@ -382,9 +471,9 @@ void EffectRack::startDrag(int idx) return; } FILE *tmp; - if (debugMsg) { + if (MusEGlobal::debugMsg) { QString fileName; - getUniqueTmpfileName("tmp","preset", fileName); + MusEGlobal::getUniqueTmpfileName("tmp","preset", fileName); tmp = fopen(fileName.toLatin1().data(), "w+"); } else @@ -501,7 +590,7 @@ void EffectRack::dropEvent(QDropEvent *event) { //bool popenFlag = false; bool popenFlag; - FILE* fp = fileOpen(this, text, ".pre", "r", popenFlag, false, false); + FILE* fp = MusEWidget::fileOpen(this, text, ".pre", "r", popenFlag, false, false); if (fp) { Xml xml(fp); @@ -525,15 +614,17 @@ void EffectRack::dragEnterEvent(QDragEnterEvent *event) void EffectRack::mousePressEvent(QMouseEvent *event) { + RackSlot* item = (RackSlot*) itemAt(event->pos()); if(event->button() & Qt::LeftButton) { dragPos = event->pos(); } else if(event->button() & Qt::RightButton) { - menuRequested(itemAt(event->pos())); + setCurrentItem(item); + menuRequested(item); return; } else if(event->button() & Qt::MidButton) { - int idx = row(itemAt(event->pos())); + int idx = row(item); bool flag = !track->efxPipe()->isOn(idx); track->efxPipe()->setOn(idx, flag); updateContents(); diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h index 2b1bbb66..a2f2a25a 100644 --- a/muse2/muse/mixer/rack.h +++ b/muse2/muse/mixer/rack.h @@ -4,6 +4,21 @@ // $Id: rack.h,v 1.5.2.3 2006/09/24 19:32:31 terminator356 Exp $ // // (C) Copyright 2000 Werner Schweer (ws@seh.de) +// +// 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 __RACK_H__ @@ -28,8 +43,8 @@ class EffectRack : public QListWidget { AudioTrack* track; + int itemheight; - virtual QSize minimumSizeHint() const; virtual QSize sizeHint() const; diff --git a/muse2/muse/mixer/routedialog.cpp b/muse2/muse/mixer/routedialog.cpp index 29ff8946..53b8d48b 100644 --- a/muse2/muse/mixer/routedialog.cpp +++ b/muse2/muse/mixer/routedialog.cpp @@ -4,6 +4,21 @@ // $Id: routedialog.cpp,v 1.5.2.2 2007/01/04 00:35:17 terminator356 Exp $ // // (C) Copyright 2004 Werner Schweer (ws@seh.de) +// +// 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 <QCloseEvent> @@ -86,7 +101,7 @@ void RouteDialog::routingChanged() new QTreeWidgetItem(routeList, QStringList() << src << r->name()); } } - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; std::list<QString> sl = audioDevice->outputPorts(); for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i) newSrcList->addItem(*i); diff --git a/muse2/muse/mixer/routedialog.h b/muse2/muse/mixer/routedialog.h index 39bbce2c..d5326ab3 100644 --- a/muse2/muse/mixer/routedialog.h +++ b/muse2/muse/mixer/routedialog.h @@ -4,6 +4,21 @@ // $Id: routedialog.h,v 1.2 2004/01/31 17:31:49 wschweer Exp $ // // (C) Copyright 2004 Werner Schweer (ws@seh.de) +// +// 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 __ROUTEDIALOG_H__ diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index 3cf9765d..750f1623 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -4,6 +4,21 @@ // $Id: strip.cpp,v 1.6.2.5 2009/11/14 03:37:48 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 <QToolButton> @@ -54,7 +69,7 @@ void Strip::recordToggled(bool val) { if (track->type() == Track::AUDIO_OUTPUT) { if (val && track->recordFlag() == false) { - muse->bounceToFile((AudioOutput*)track); + MusEGlobal::muse->bounceToFile((AudioOutput*)track); } audio->msgSetRecord((AudioOutput*)track, val); if (!((AudioOutput*)track)->recFile()) @@ -80,9 +95,9 @@ void Strip::setLabelFont() { // Use the new font #6 I created just for these labels (so far). // Set the label's font. - label->setFont(config.fonts[6]); + label->setFont(MusEConfig::config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); + MusEUtil::autoAdjustFontSize(label, label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -95,35 +110,35 @@ void Strip::setLabelText() switch(track->type()) { case Track::AUDIO_OUTPUT: //c = Qt::green; - c = config.outputTrackLabelBg; + c = MusEConfig::config.outputTrackLabelBg; break; case Track::AUDIO_GROUP: //c = Qt::yellow; - c = config.groupTrackLabelBg; + c = MusEConfig::config.groupTrackLabelBg; break; case Track::AUDIO_AUX: //c = QColor(120, 255, 255); // Light blue - c = config.auxTrackLabelBg; + c = MusEConfig::config.auxTrackLabelBg; break; case Track::WAVE: //c = Qt::magenta; - c = config.waveTrackLabelBg; + c = MusEConfig::config.waveTrackLabelBg; break; case Track::AUDIO_INPUT: //c = Qt::red; - c = config.inputTrackLabelBg; + c = MusEConfig::config.inputTrackLabelBg; break; case Track::AUDIO_SOFTSYNTH: //c = QColor(255, 130, 0); // Med orange - c = config.synthTrackLabelBg; + c = MusEConfig::config.synthTrackLabelBg; break; case Track::MIDI: //c = QColor(0, 160, 255); // Med blue - c = config.midiTrackLabelBg; + c = MusEConfig::config.midiTrackLabelBg; break; case Track::DRUM: //c = QColor(0, 160, 255); // Med blue - c = config.drumTrackLabelBg; + c = MusEConfig::config.drumTrackLabelBg; break; default: return; @@ -207,7 +222,7 @@ Strip::Strip(QWidget* parent, Track* t) // Moved by Tim. p3.3.9 //setLabelText(); - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); //printf("Strip::Strip w:%d frw:%d layoutmarg:%d lx:%d ly:%d lw:%d lh:%d\n", STRIP_WIDTH, frameWidth(), layout->margin(), label->x(), label->y(), label->width(), label->height()); diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h index cf3babe8..602e6e07 100644 --- a/muse2/muse/mixer/strip.h +++ b/muse2/muse/mixer/strip.h @@ -4,6 +4,21 @@ // $Id: strip.h,v 1.3.2.2 2009/11/14 03:37:48 terminator356 Exp $ // // (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) +// +// 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 __STRIP_H__ @@ -21,10 +36,13 @@ class Track; class QLabel; //class QVBoxLayout; -class Meter; class QToolButton; class QGridLayout; + +namespace MusEWidget { class ComboBox; +class Meter; +} static const int STRIP_WIDTH = 65; @@ -41,7 +59,7 @@ class Strip : public QFrame { //QVBoxLayout* layout; QGridLayout* grid; int _curGridRow; - Meter* meter[MAX_CHANNELS]; + MusEWidget::Meter* meter[MAX_CHANNELS]; bool useSoloIconSet2; QToolButton* record; @@ -50,7 +68,7 @@ class Strip : public QFrame { QToolButton* iR; // Input routing button QToolButton* oR; // Output routing button QGridLayout* sliderGrid; - ComboBox* autoType; + MusEWidget::ComboBox* autoType; void setLabelText(); private slots: |